import sys

stack = []

array = sys.stdin.readline().strip().split(" ")

for op in array:
    if op.isdigit():
        stack.append(int(op))
    else:
        tmp1 = stack.pop()
        tmp2 = stack.pop()
        if op == "+":
            stack.append(tmp1 + tmp2)
        elif op == "-":
            stack.append(tmp2 - tmp1)
        elif op == "*":
            stack.append(tmp1 * tmp2)
        elif op == "/":
            stack.append(float(tmp2) / tmp1)
res = stack.pop()
print str(int(res)) import sys sys stack = [] stack [] array = sys.stdin.readline().strip().split(" ") array sys.stdin.readline().strip().split(" ") sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split " " for op in array:
    if op.isdigit():
        stack.append(int(op))
    else:
        tmp1 = stack.pop()
        tmp2 = stack.pop()
        if op == "+":
            stack.append(tmp1 + tmp2)
        elif op == "-":
            stack.append(tmp2 - tmp1)
        elif op == "*":
            stack.append(tmp1 * tmp2)
        elif op == "/":
            stack.append(float(tmp2) / tmp1) op array if op.isdigit():
        stack.append(int(op))
    else:
        tmp1 = stack.pop()
        tmp2 = stack.pop()
        if op == "+":
            stack.append(tmp1 + tmp2)
        elif op == "-":
            stack.append(tmp2 - tmp1)
        elif op == "*":
            stack.append(tmp1 * tmp2)
        elif op == "/":
            stack.append(float(tmp2) / tmp1) op.isdigit() op.isdigit op isdigit stack.append(int(op)) stack.append stack append int(op) int op tmp1 = stack.pop() tmp1 stack.pop() stack.pop stack pop tmp2 = stack.pop() tmp2 stack.pop() stack.pop stack pop if op == "+":
            stack.append(tmp1 + tmp2)
        elif op == "-":
            stack.append(tmp2 - tmp1)
        elif op == "*":
            stack.append(tmp1 * tmp2)
        elif op == "/":
            stack.append(float(tmp2) / tmp1) op == "+" op "+" stack.append(tmp1 + tmp2) stack.append stack append tmp1 + tmp2 tmp1 tmp2 elif op == "-":
            stack.append(tmp2 - tmp1)
         op == "-" op "-" stack.append(tmp2 - tmp1) stack.append stack append tmp2 - tmp1 tmp2 tmp1 elif op == "*":
            stack.append(tmp1 * tmp2)
         op == "*" op "*" stack.append(tmp1 * tmp2) stack.append stack append tmp1 * tmp2 tmp1 tmp2 elif op == "/":
            stack.append(float(tmp2) / tmp1) op == "/" op "/" stack.append(float(tmp2) / tmp1) stack.append stack append float(tmp2) / tmp1 float(tmp2) float tmp2 tmp1 res = stack.pop() res stack.pop() stack.pop stack pop print str(int(res)) str int(res) int res array = sys.stdin.readline().strip().split(" ") sys.stdin.readline().strip().split(" ") array tmp1 = stack.pop() stack.pop() tmp1 tmp2 = stack.pop() stack.pop() tmp2 stack = [] [] stack res = stack.pop() stack.pop() res
import sys

stack = []

array = sys.stdin.readline().strip().split(" ")

for op in array:
    if op.isdigit():
        stack.append(int(op))
    else:
        tmp1 = stack.pop()
        tmp2 = stack.pop()
        if op == "+":
            stack.append(tmp1 + tmp2)
        elif op == "-":
            stack.append(tmp2 - tmp1)
        elif op == "*":
            stack.append(tmp1 * tmp2)
        elif op == "/":
            stack.append(float(tmp2) / tmp1)
res = stack.pop()
print str(int(res))