def calc(formura):
    if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2])


formura = [i for i in input().split()]
stack = []

for i in range(len(formura)):
    if formura[i] == '+' or formura[i] == '-' or formura[i] == '*' or formura[i] == '-':
        stack.append(formura[i])
        result = calc(stack)
        for j in range(3):
            stack.pop(-1)
        stack.append(result)
    else:
        stack.append(formura[i])

print(stack[0]) def calc(formura):
    if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2]) calc if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2]) formura[-1] == '+' formura[-1] formura -1 '+' return int(formura[-3]) + int(formura[-2]) int(formura[-3]) + int(formura[-2]) int(formura[-3]) int formura[-3] formura -3 int(formura[-2]) int formura[-2] formura -2 elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
     formura[-1] == '-' formura[-1] formura -1 '-' return int(formura[-3]) - int(formura[-2]) int(formura[-3]) - int(formura[-2]) int(formura[-3]) int formura[-3] formura -3 int(formura[-2]) int formura[-2] formura -2 elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
     formura[-1] == '*' formura[-1] formura -1 '*' return int(formura[-3]) * int(formura[-2]) int(formura[-3]) * int(formura[-2]) int(formura[-3]) int formura[-3] formura -3 int(formura[-2]) int formura[-2] formura -2 elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2]) formura[len(formura)-1] == '/' formura[len(formura)-1] formura len(formura)-1 len(formura) len formura 1 '/' return int(formura[-3]) / int(formura[-2]) int(formura[-3]) / int(formura[-2]) int(formura[-3]) int formura[-3] formura -3 int(formura[-2]) int formura[-2] formura -2 formura formura i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i formura = [i for i in input().split()] formura [i for i in input().split()] stack = [] stack [] for i in range(len(formura)):
    if formura[i] == '+' or formura[i] == '-' or formura[i] == '*' or formura[i] == '-':
        stack.append(formura[i])
        result = calc(stack)
        for j in range(3):
            stack.pop(-1)
        stack.append(result)
    else:
        stack.append(formura[i]) i range(len(formura)) range len(formura) len formura if formura[i] == '+' or formura[i] == '-' or formura[i] == '*' or formura[i] == '-':
        stack.append(formura[i])
        result = calc(stack)
        for j in range(3):
            stack.pop(-1)
        stack.append(result)
    else:
        stack.append(formura[i]) formura[i] == '+' or formura[i] == '-' or formura[i] == '*' or formura[i] == '-' formura[i] == '+' or formura[i] == '-' or formura[i] == '*' formura[i] == '+' or formura[i] == '-' formura[i] == '+' formura[i] formura i '+' formura[i] == '-' formura[i] formura i '-' formura[i] == '*' formura[i] formura i '*' formura[i] == '-' formura[i] formura i '-' stack.append(formura[i]) stack.append stack append formura[i] formura i result = calc(stack) result calc(stack) calc stack for j in range(3):
            stack.pop(-1)
         j range(3) range 3 stack.pop(-1) stack.pop stack pop -1 stack.append(result) stack.append stack append result stack.append(formura[i]) stack.append stack append formura[i] formura i print(stack[0]) print stack[0] stack 0 formura = [i for i in input().split()] [i for i in input().split()] formura stack = [] [] stack def calc(formura):
    if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2]) def calc(formura):
    if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2]) calc result = calc(stack) calc(stack) result
def calc(formura):
    if formura[-1] == '+':
        return int(formura[-3]) + int(formura[-2])
    elif formura[-1] == '-':
        return int(formura[-3]) - int(formura[-2])
    elif formura[-1] == '*':
        return int(formura[-3]) * int(formura[-2])
    elif formura[len(formura)-1] == '/':
        return int(formura[-3]) / int(formura[-2])


formura = [i for i in input().split()]
stack = []

for i in range(len(formura)):
    if formura[i] == '+' or formura[i] == '-' or formura[i] == '*' or formura[i] == '-':
        stack.append(formura[i])
        result = calc(stack)
        for j in range(3):
            stack.pop(-1)
        stack.append(result)
    else:
        stack.append(formura[i])

print(stack[0])