#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 1;   long long a[4], mn = 1e12 + 1;   char b, c, d;   int main() {     cin >> a[0] >> a[1] >> a[2] >> a[3];     cin >> b >> c >> d;     sort(a, a + 4);     do {       long long first, second, temp;       if (b ==  + )         first = a[0] + a[1];       else         first = a[0] * a[1];       long long a1[3];       a1[0] = first;       a1[1] = a[2];       a1[2] = a[3];       sort(a1, a1 + 3);       do {         if (c ==  + )           second = a1[0] + a1[1];         else           second = a1[0] * a1[1];         if (d ==  + )           temp = second + a1[2];         else           temp = second * a1[2];         mn = min(mn, temp);       } while (next_permutation(a1, a1 + 3));     } while (next_permutation(a, a + 4));     cout << mn;     return 0;   }   