input_ = raw_input().split()

stack = []
for s in input_:
    if s.isdigit():
        stack.append(s)
    else:
        x = stack.pop()
        y = stack.pop()
        ans = eval(y + s + x)
        stack.append(str(ans))
        
print stack[0] input_ = raw_input().split() input_ raw_input().split() ().split () raw_input split stack = [] stack [] for s in input_:
    if s.isdigit():
        stack.append(s)
    else:
        x = stack.pop()
        y = stack.pop()
        ans = eval(y + s + x)
        stack.append(str(ans))
         s input_ if s.isdigit():
        stack.append(s)
    else:
        x = stack.pop()
        y = stack.pop()
        ans = eval(y + s + x)
        stack.append(str(ans))
         s.isdigit() s.isdigit s isdigit stack.append(s) stack.append stack append s x = stack.pop() x stack.pop() stack.pop stack pop y = stack.pop() y stack.pop() stack.pop stack pop ans = eval(y + s + x) ans eval(y + s + x) eval y + s + x y + s y s x stack.append(str(ans)) stack.append stack append str(ans) str ans print stack[0] stack 0 y = stack.pop() stack.pop() y x = stack.pop() stack.pop() x ans = eval(y + s + x) eval(y + s + x) ans input_ = raw_input().split() raw_input().split() input_ stack = [] [] stack
input_ = raw_input().split()

stack = []
for s in input_:
    if s.isdigit():
        stack.append(s)
    else:
        x = stack.pop()
        y = stack.pop()
        ans = eval(y + s + x)
        stack.append(str(ans))
        
print stack[0]