import java.io.*;
import java.util.*;

public class expr_md implements Runnable {
	private BufferedReader in;
	private PrintWriter out;
	int[] a;

	public void run() {
		try {
			solve();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	int[] lo = new int[50];
	int[] hi = new int[50];
	long[] p = new long[50];
	int[] on = new int[50];
	long[][] b = new long[50][50];
	int[][] how = new int[50][50];
	
	private void solve(int from, int to, boolean canHaveZero) {
		if (from + 1 == to) {
			out.print(a[from]);
			return;
		}
		if (canHaveZero) {
			for (int i = from; i < to; i++) {
				if (a[i] == 0) {
					if (i > from) {
						solve(from, i, false);
						out.print("+");
					}
					out.print("0");
					if (i < to - 1) {
						out.print("+");
						solve(i + 1, to, true);
					}
					return;
				}
			}
		}
		while (from + 1 < to && a[from] == 1) {
			out.print("1+");
			from++;
		}
		int ones = 0;
		while (from + 1 < to && a[to - 1] == 1) {
			ones++;
			to--;
		}
		if (ones > 0) {
			solve(from, to, false);
			for (int i = 0; i < ones; i++)
				out.print("+1");
			return;
		}
		if (from + 1 == to) {
			out.print(a[from]);
			return;
		}
		long limit1 = to - from;
		long limit2 = limit1 * limit1;
		long prodAll = 1;
		int m = 0;
		for (int i = from; i < to;) {
			int low = i;
			long prod = 1;
			while (i < to && a[i] > 1) {
				prod *= a[i];
				if (prod > limit1) {
					multiply(from, to);
					return;
				}
				i++;
			}
			int high = i;
			prodAll *= prod;
			if (prodAll > limit2) {
				multiply(from, to);
				return;
			}
			lo[m] = low;
			hi[m] = high;
			p[m] = prod;
			if (i == to)
				break;
			ones = 0;
			while (a[i] == 1) {
				ones++;
				i++;
			}
			on[m] = ones;
			m++;
		}
		m++;
		for (int i = m - 1; i >= 0; i--) {
			b[i][i + 1] = p[i];
			how[i][i + 1] = -1;
			for (int j = i + 2; j <= m; j++) {
				long pr = 1;
				for (int k = i; k < j; k++) {
					pr *= p[k];
				}
				b[i][j] = pr;
				how[i][j] = -1;
				for (int k = i + 1; k < j; k++) {
					long cur = b[i][k] + on[k - 1] + b[k][j];
					if (cur > b[i][j]) {
						b[i][j] = cur;
						how[i][j] = k;
					}
				}
			}
		}
		optimal(0, m);
	}

	private void optimal(int i, int j) {
		int k = how[i][j];
		if (k >= 0) {
			optimal(i, k);
			for (int l = 0; l < on[k - 1]; l++) {
				out.print("+1");
			}
			out.print("+");
			optimal(k, j);
			return;
		}
		multiply(lo[i], hi[j - 1]);
	}

	private void multiply(int from, int to) {
		for (int i = from; i < to; i++) {
			if (i > from)
				out.print("*");
			out.print(a[i]);
		}
	}

	private void solve() throws IOException {
		Locale.setDefault(Locale.US);
		in = new BufferedReader(new FileReader("expr.in"));
		out = new PrintWriter("expr.out");
		int n = Integer.parseInt(in.readLine());
		StringTokenizer st = new StringTokenizer(in.readLine());
		a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}
		solve(0, n, true);
		out.println();
		in.close();
		out.close();
	}

	public static void main(String[] args) {
		new Thread(new expr_md()).start();
	}
}
