
def arg(operator):
    try:
        return elements.index(operator)
    except:
        return 100000000000000


elements = [elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split()]

while len(elements) != 1:
    if arg('+') or arg('-') or arg('*'):
        i = arg('+')
        i = min(i, arg('-'))
        i = min(i, arg('*'))

        if elements[i] == '+': r = elements[i-2] + elements[i-1]
        elif elements[i] == '-': r = elements[i-2] - elements[i-1]
        elif elements[i] == '*': r = elements[i-2] * elements[i-1]

        # i, i-1, i-2 -> one element
        elements = elements[:i-2] + [r] + elements[i+1:]
    else:
        break

print(elements[0]) def arg(operator):
    try:
        return elements.index(operator)
    except:
        return 100000000000000 arg try:
        return elements.index(operator)
    except:
        return 100000000000000 except:
        return 100000000000000 return 100000000000000 100000000000000 return elements.index(operator) elements.index(operator) elements.index elements index operator operator operator elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split() for elem in input().split() elem input().split() ().split () input split for elem in input().split() elem if elem in ['+', '-', '*']
            else int(elem) elem in ['+', '-', '*'] elem ['+', '-', '*'] '+' '-' '*' elem int(elem) int elem elements = [elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split()] elements [elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split()] while len(elements) != 1:
    if arg('+') or arg('-') or arg('*'):
        i = arg('+')
        i = min(i, arg('-'))
        i = min(i, arg('*'))

        if elements[i] == '+': r = elements[i-2] + elements[i-1]
        elif elements[i] == '-': r = elements[i-2] - elements[i-1]
        elif elements[i] == '*': r = elements[i-2] * elements[i-1]

        # i, i-1, i-2 -> one element
        elements = elements[:i-2] + [r] + elements[i+1:]
    else:
        break len(elements) != 1 len(elements) len elements 1 if arg('+') or arg('-') or arg('*'):
        i = arg('+')
        i = min(i, arg('-'))
        i = min(i, arg('*'))

        if elements[i] == '+': r = elements[i-2] + elements[i-1]
        elif elements[i] == '-': r = elements[i-2] - elements[i-1]
        elif elements[i] == '*': r = elements[i-2] * elements[i-1]

        # i, i-1, i-2 -> one element
        elements = elements[:i-2] + [r] + elements[i+1:]
    else:
        break arg('+') or arg('-') or arg('*') arg('+') or arg('-') arg('+') arg '+' arg('-') arg '-' arg('*') arg '*' i = arg('+') i arg('+') arg '+' i = min(i, arg('-')) i min(i, arg('-')) min i arg('-') arg '-' i = min(i, arg('*')) i min(i, arg('*')) min i arg('*') arg '*' if elements[i] == '+': r = elements[i-2] + elements[i-1]
        elif elements[i] == '-': r = elements[i-2] - elements[i-1]
        elif elements[i] == '*': r = elements[i-2] * elements[i-1]

        # i, i-1, i-2 -> one element
         elements[i] == '+' elements[i] elements i '+' elif elements[i] == '-': r = elements[i-2] - elements[i-1]
         elements[i] == '-' elements[i] elements i '-' elif elements[i] == '*': r = elements[i-2] * elements[i-1]

        # i, i-1, i-2 -> one element
         elements[i] == '*' elements[i] elements i '*' elements = elements[:i-2] + [r] + elements[i+1:] elements elements[:i-2] + [r] + elements[i+1:] elements[:i-2] + [r] elements[:i-2] elements :i-2 i-2 i 2 [r] r elements[i+1:] elements i+1: i+1 i 1 break print(elements[0]) print elements[0] elements 0 i = min(i, arg('*')) min(i, arg('*')) i def arg(operator):
    try:
        return elements.index(operator)
    except:
        return 100000000000000 def arg(operator):
    try:
        return elements.index(operator)
    except:
        return 100000000000000 arg i = min(i, arg('-')) min(i, arg('-')) i elements = elements[:i-2] + [r] + elements[i+1:] elements[:i-2] + [r] + elements[i+1:] elements elements = [elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split()] [elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split()] elements i = arg('+') arg('+') i

def arg(operator):
    try:
        return elements.index(operator)
    except:
        return 100000000000000


elements = [elem if elem in ['+', '-', '*']
            else int(elem) for elem in input().split()]

while len(elements) != 1:
    if arg('+') or arg('-') or arg('*'):
        i = arg('+')
        i = min(i, arg('-'))
        i = min(i, arg('*'))

        if elements[i] == '+': r = elements[i-2] + elements[i-1]
        elif elements[i] == '-': r = elements[i-2] - elements[i-1]
        elif elements[i] == '*': r = elements[i-2] * elements[i-1]

        # i, i-1, i-2 -> one element
        elements = elements[:i-2] + [r] + elements[i+1:]
    else:
        break

print(elements[0])