A = list(map(str,input().split()))
Stack = []
for e in A:
    if e.isdigit():
        Stack.append(int(e))
    else:
        right = Stack.pop()
        left = Stack.pop()
        if e == "+":
            Stack.append(left+right)
        elif e == "-":
            Stack.append(left-right)
        elif e == "*":
            Stack.append(left*right)
        else:
            if right != 0:
                Stack.append(left//right)
            else:
                print("0?????????")
                exit()

print(Stack.pop()) A = list(map(str,input().split())) A list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split Stack = [] Stack [] for e in A:
    if e.isdigit():
        Stack.append(int(e))
    else:
        right = Stack.pop()
        left = Stack.pop()
        if e == "+":
            Stack.append(left+right)
        elif e == "-":
            Stack.append(left-right)
        elif e == "*":
            Stack.append(left*right)
        else:
            if right != 0:
                Stack.append(left//right)
            else:
                print("0?????????")
                exit() e A if e.isdigit():
        Stack.append(int(e))
    else:
        right = Stack.pop()
        left = Stack.pop()
        if e == "+":
            Stack.append(left+right)
        elif e == "-":
            Stack.append(left-right)
        elif e == "*":
            Stack.append(left*right)
        else:
            if right != 0:
                Stack.append(left//right)
            else:
                print("0?????????")
                exit() e.isdigit() e.isdigit e isdigit Stack.append(int(e)) Stack.append Stack append int(e) int e right = Stack.pop() right Stack.pop() Stack.pop Stack pop left = Stack.pop() left Stack.pop() Stack.pop Stack pop if e == "+":
            Stack.append(left+right)
        elif e == "-":
            Stack.append(left-right)
        elif e == "*":
            Stack.append(left*right)
        else:
            if right != 0:
                Stack.append(left//right)
            else:
                print("0?????????")
                exit() e == "+" e "+" Stack.append(left+right) Stack.append Stack append left+right left right elif e == "-":
            Stack.append(left-right)
         e == "-" e "-" Stack.append(left-right) Stack.append Stack append left-right left right elif e == "*":
            Stack.append(left*right)
         e == "*" e "*" Stack.append(left*right) Stack.append Stack append left*right left right if right != 0:
                Stack.append(left//right)
            else:
                print("0?????????")
                exit() right != 0 right 0 Stack.append(left//right) Stack.append Stack append left//right left right print("0?????????") print "0?????????" exit() exit print(Stack.pop()) print Stack.pop() Stack.pop Stack pop A = list(map(str,input().split())) list(map(str,input().split())) A right = Stack.pop() Stack.pop() right left = Stack.pop() Stack.pop() left Stack = [] [] Stack
A = list(map(str,input().split()))
Stack = []
for e in A:
    if e.isdigit():
        Stack.append(int(e))
    else:
        right = Stack.pop()
        left = Stack.pop()
        if e == "+":
            Stack.append(left+right)
        elif e == "-":
            Stack.append(left-right)
        elif e == "*":
            Stack.append(left*right)
        else:
            if right != 0:
                Stack.append(left//right)
            else:
                print("0?????????")
                exit()

print(Stack.pop())