#include<cstdio>
#include<set>
using namespace std;
int main(int argc,char **argv){
int mul=0,ans=0;
multiset<int> heap;
for(int iter=1;iter<=4;++iter){
int got;
scanf("%d",&got);
heap.insert(got);
};
for(int iter=1;iter<=3;++iter){
getchar();
char got=getchar();
if(got=='*'){
++mul;
};
};
while(mul--){
int top1=*heap.begin();
int top2;
heap.erase(heap.begin());
if(top1<=1){
multiset<int>::iterator pos=heap.end();
--pos;
top2=*pos;
heap.erase(pos);
}else{
top2=*heap.begin();
heap.erase(heap.begin());
};
heap.insert(top1*top2);
};
while(!heap.empty()){
ans+=*heap.begin();
heap.erase(heap.begin());
};
printf("%d",ans);
return 0;
};