# -*- coding: utf-8 -*-

if __name__ == '__main__':

    stack = []
    line = input().split(" ")
    for s in line:
        if s.isdigit():
            stack.append(s)
        else:
            v2 = stack.pop()
            v1 = stack.pop()
            stack.append(str(eval(v1 + s + v2)))

    print(stack.pop())

 if __name__ == '__main__':

    stack = []
    line = input().split(" ")
    for s in line:
        if s.isdigit():
            stack.append(s)
        else:
            v2 = stack.pop()
            v1 = stack.pop()
            stack.append(str(eval(v1 + s + v2)))

    print(stack.pop()) __name__ == '__main__' __name__ '__main__' stack = [] stack [] line = input().split(" ") line input().split(" ") ().split () input split " " for s in line:
        if s.isdigit():
            stack.append(s)
        else:
            v2 = stack.pop()
            v1 = stack.pop()
            stack.append(str(eval(v1 + s + v2)))

     s line if s.isdigit():
            stack.append(s)
        else:
            v2 = stack.pop()
            v1 = stack.pop()
            stack.append(str(eval(v1 + s + v2)))

     s.isdigit() s.isdigit s isdigit stack.append(s) stack.append stack append s v2 = stack.pop() v2 stack.pop() stack.pop stack pop v1 = stack.pop() v1 stack.pop() stack.pop stack pop stack.append(str(eval(v1 + s + v2))) stack.append stack append str(eval(v1 + s + v2)) str eval(v1 + s + v2) eval v1 + s + v2 v1 + s v1 s v2 print(stack.pop()) print stack.pop() stack.pop stack pop v1 = stack.pop() stack.pop() v1 v2 = stack.pop() stack.pop() v2 line = input().split(" ") input().split(" ") line stack = [] [] stack
# -*- coding: utf-8 -*-

if __name__ == '__main__':

    stack = []
    line = input().split(" ")
    for s in line:
        if s.isdigit():
            stack.append(s)
        else:
            v2 = stack.pop()
            v1 = stack.pop()
            stack.append(str(eval(v1 + s + v2)))

    print(stack.pop())


