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.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.text.StyledEditorKit.ItalicAction;

import static java.lang.Double.*;
import static java.lang.Integer.*;
import static java.math.BigInteger.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main implements Runnable {
	
	private void solve() throws IOException {
//		long start = System.currentTimeMillis();
		readData();
		processing();
	}
	
	private void processing() {
		minValue *= 1000000;
		rec(a, 0);
		println(minValue);
	}
	
	private void rec(long[] a, int pos) {
		if (pos == 3) {
			minValue = min(minValue, a[0]);
		}
		else {
			int n = a.length;
			long[] na = new long[n-1];
			for (int j = 0; j < n-1; ++j) {
				for (int second = 0; second < n; ++second) {
					if (second != j) {
						long value = 0;
						if (s[pos] == '+') {
							value = a[j] + a[second];
						}
						else {
							value = a[j] * a[second];
						}
						int cur = 0;
						for (int i = 0; i < n; ++i) {
							if (i == second) {
								na[cur++] = value;
							}
							else if (i != j) {
								na[cur++] = a[i];
							}
						}
						rec(na, pos+1);
					}
				}
			}
		}
	}

	private long minValue = Integer.MAX_VALUE;
	
	private void readData() throws IOException {
		a = new long[4];
		for (int i = 0; i < 4; ++i) {
			a[i] = nextLong();
		}
		s = new char[3];
		for (int i = 0; i < 3; ++i) {
			s[i] = nextToken().charAt(0);
		}
	}
	
	private long[] a;
	private char[] s;
	
	public static void main(String[] args) throws InterruptedException {
		new Thread(null, new Runnable() {
			public void run() {
				new Main().run();
			}
		}, "1", 1 << 24).start();
	}

	// @Override
	public void run() {
		try {
			boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;
			reader = onlineJudge ? new BufferedReader(new InputStreamReader(
					System.in)) : new BufferedReader(
					new FileReader("input.txt"));
			writer = onlineJudge ? new PrintWriter(new BufferedWriter(
					new OutputStreamWriter(System.out))) : new PrintWriter(
					new BufferedWriter(new FileWriter("output.txt")));
			Locale.setDefault(Locale.US);
			tokenizer = null;
			solve();
			writer.flush();
		} catch (Exception error) {
			error.printStackTrace();
			System.exit(1);
		}
	}

	private BufferedReader reader;
	private PrintWriter writer;
	private StringTokenizer tokenizer;

	private void println() {
		writer.println();
	}
	
	private void print(long value) {
		writer.print(value);
	}
	
	private void println(long value) {
		writer.println(value);
	}
	
	private void print(char ch) {
		writer.print(ch);
	}

	private void println(String s) {
		writer.println(s);
	}

	private void print(String s) {
		writer.print(s);
	}
	
	private void print(int value) {
		writer.print(value);
	}
	
	private void println(int value) {
		writer.println(value);
	}

	private void printf(String f, double d) {
		writer.printf(f, d);
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}