Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next three minutes he took two numbers from the blackboard (not necessarily adjacent) and replaced them with their sum or their product. In the end he got one number. Unfortunately, due to the awful memory he forgot that number, but he remembers four original numbers, sequence of the operations and his surprise because of the very small result. Help Vladimir remember the forgotten number: find the smallest number that can be obtained from the original numbers by the given sequence of operations.

Input

First line contains four integers separated by space: 0 ≤ a, b, c, d ≤ 1000 — the original numbers. Second line contains three signs ('+' or '*' each) separated by space — the sequence of the operations in the order of performing. ('+' stands for addition, '*' — multiplication)

Output

Output one integer number — the minimal result which can be obtained.

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).

Examples

Input

1 1 1 1
+ + *


Output

3


Input

2 2 2 2
* * +


Output

8


Input

1 2 3 4
* + +


Output

9


import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class ProblemB_51 {
	
	final boolean ONLINE_JUDGE=System.getProperty("ONLINE_JUDGE")!=null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok=new StringTokenizer("");
	
	void init() throws FileNotFoundException{
		if (ONLINE_JUDGE){
			in=new BufferedReader(new InputStreamReader(System.in));
			out =new PrintWriter(System.out);
		}
		else{
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}
	
	String readString() throws IOException{
		while(!tok.hasMoreTokens()){
			tok=new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}
	
	int readInt() throws IOException{
		return Integer.parseInt(readString());
	}
	
	public static void main(String[] args){
		new ProblemB_51().run();
	}
	
	public void run(){
		try{
			long t1=System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2=System.currentTimeMillis();
			System.err.println("Time = "+(t2-t1));
		}catch (Exception e){
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
	
	void solve() throws IOException{
		long[] a=new long[6];
		for (int i=0; i<4; i++){
			a[i]=readInt();
		}
		a[5]=0;
		String[] c=new String[3];
		for (int i=0; i<3; i++){
			c[i]=readString();
		}
		HashSet<Integer> b=new HashSet<Integer>();
		long min=Long.MAX_VALUE;
		for (int i1=0; i1<4; i1++){
			b.clear();
			a[5]=0;
			a[4]=a[i1];
			b.add(i1);
			for (int i2=0; i2<4; i2++){
				if (!b.contains(i2)){
					b.add(i2);
					if (c[0].charAt(0)=='+'){
						a[4]+=a[i2];
					}else{
						a[4]*=a[i2];
					}
					for (int i3=0; i3<5; i3++){
						if (!b.contains(i3)){
							b.add(i3);
							a[5]=a[i3];
							for (int i4=0; i4<5; i4++){
								if (!b.contains(i4)){
									b.add(i4);
									if (c[1].charAt(0)=='+'){
										a[5]+=a[i4];
									}else{
										a[5]*=a[i4];
									}
									for (int i=0; i<5; i++){
										if(!b.contains(i)){
												long res=0;
												if (c[2].charAt(0)=='+'){
													res=a[5]+a[i];
												}else{
													res=a[5]*a[i];
												}			
												if (res<min){
													min=res;
												}			
											}
										}
									b.remove(i4);
									a[5]=a[i3];
								}
							}
							b.remove(i3);
							a[5]=0;
						}
					}
					b.remove(i2);
					if (c[0].charAt(0)=='+'){
						a[4]=a[i1];
					}else{
						a[4]=a[i1];
					}
				}
			}
		}
		out.print(min);
	}		
}

