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.
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)
'''''
arr= [1,3,4,3]
i=0
for k in range(8):
    if i!=arr[i]-1:
        if arr[i]!=arr[arr[i]-1]:
            print(arr[i],arr[arr[i]-1],arr,i)
            arr[i],arr[arr[i]-1]=arr[arr[i]-1],arr[i]
        else:
            i+=1
    else:
        i+=1
print(arr)
'''''

'''
def AllParenthesis(n):

    def backtrack(ans,curr,openp,closep,maxp):
        if len(curr)==2*maxp:
            ans.append(curr)
            return
        if openp<maxp:
            backtrack(ans,curr+"(",openp+1,closep,maxp)
        if closep<openp:
            backtrack(ans,curr+")",openp,closep+1,maxp)


    ans = []
    openp, closep = 0, 0
    curr = ''
    backtrack(ans, curr, openp, closep, n)
    return ans
print(AllParenthesis(3))
'''

#mat = [[1,2,3],[4,5,6],[7,8,9]]

'''temp=[[0 for x in range(len(mat[0]))]for x in range(len(mat))]
for i in range(len(mat)):
    temp[i][0]=mat[i][0]
    for j in range(1,len(mat[0])):
        temp[i][j]=temp[i][j-1]+mat[i][j]
for i in range(1,len(mat)):
    for j in range(len(mat[0])):
        temp[i][j]=temp[i-1][j]+temp[i][j]

k=3
lr=0
lc=0
rr=0
rc=0
ans=[[0 for x in range(len(mat[0]))]for x in range(len(mat))]
for i in range(len(mat)):
    for j in range(len(mat[0])):
        area1 = 0
        area2 = 0
        area3 = 0

        lr=i
        lc=j
        if i-k>=0:
            lr=i-k
        else:
            lr=0
        if j-k>=0:
            lc=j-k
        else:
            lc=0
        rr=i
        rc=j
        if i+k<len(mat):
            rr=i+k
        else:
            rr=len(mat)-1
        if j+k<len(mat[0]):
            rc=j+k
        else:
            rc=len(mat[0])-1
        if lc-1>=0:
            area1=temp[rr][lc-1]

        if lr-1>=0:
            area2=temp[lr-1][rc]
        if lr-1>=0 and lc-1>=0:
            area3=temp[lr-1][lc-1]
        ans[i][j]=temp[rr][rc]-area1-area2+area3'''


'''print(ans)'''
'''
nums = [-1,0,1,2,-1,-4]   #-1,0,1,2,-1,-4,-2,-3,3,0,4
nums.sort()
print(nums)
seen = set()
length=len(nums)
ans=[]
i=0
while i<length-2:
    l=i+1
    r=length-1
    target=nums[i]
    while l<r:
        if nums[l]+nums[r]==-target:
            seen.add((target,nums[l],nums[r]))

            while l < r and nums[l + 1] == nums[l]:
                l += 1
            while l < r and nums[r - 1] == nums[r]:
                r -= 1

            l+=1
            r-=1
        elif nums[l]+nums[r]>-target:
            r-=1
        else:
            l+=1
    i+=1
print(seen)
'''
import os
import sys
from io import BytesIO, IOBase


def main():
    pass


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

'''
def letterCombinations(digits):
    digitsmap = [0,0,['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'], ['j', 'k', 'l'], ['m', 'n', 'o'], ['p', 'q', 'r', 's'],
              ['t', 'u', 'v'], ['w', 'x', 'y', 'z']]
    temp=''
    n=len(digits)
    i=0
    ans=[]
    def allcombination(temp,i):
        if i == n:
            ans.append(temp)
            return
        for j in range(len(digitsmap[int(digits[i])])):
            allcombination(temp+digitsmap[int(digits[i])][j],i+1)
    allcombination(temp,i)
    return ans

print(letterCombinations('23'))
'''
'''
count=0
steps=0
ans=[]
def convert(a,b):
    global count,steps
    steps += 1
    #ans.append(a)
    if a>b:
  #      print(a,steps)
        steps-=1
      #  print(ans)
        return
    elif a==b:
        count+=1
     #   print(a,steps)
        #print(count)
        ans.append(a)

        return
   # print(a)
    ans.append(a)
    convert(a*2,b)
    convert((a*10)+1,b)

convert(2,162)
if count>0:
    print(count,"YES")
elif count==0:
    print('NO')

print(ans)

'''
'''N=3
n=2
i=0
box1=N
box2=0
box3=0
count=0
def move(i,N,box1,box2,box3):
    global count
    if N==0:
        #print(box1,box2,box3)
        count+=1
        return
    move(i+1,N-1,box1,box3,box2)
    print(box1,box3)
    move(i+1,N-1,box2,box1,box3)

move(i,N,box1,box2,box3)
print(count)

'''
'''
def numberOfPaths(n, m,count):

    def path(i, j,count):
        if i == n - 1 or j == m - 1:
            count += 1
            return
        path(i + 1, j,count)
        path(i, j +1,count)
    count=0
    path(0,0,count)
    return count

print(numberOfPaths(5,1,count))
'''
ans=999999999
def number(temp,nums,i,m,a):
    global ans
    if m==0 and a==0:
        ans=min(ans,eval(temp))
        return
    if a>0:
        number(temp+'+'+str(nums[i]),nums,i+1,m,a-1)
    if m>0:
        number(temp+'*'+str(nums[i]), nums, i+1, m-1, a)

nums=list(map(int,input().split()))
a=0
m=0
para=list(map(str,input().split()))
for k in para:
    if k=='+':
        a+=1
    elif k=='*':
        m+=1
temp=str(nums[0])
i=1
number(temp,nums,i,m,a)
print(ans)