S = raw_input().split(" ")
Stack = list()

def push(x):
    Stack.append(x)

def pop():
    return Stack.pop(-1)

a = 0
b = 0
for i in range(len(S)):
    if S[i] == "+":
        a = pop()
        b = pop()
        push(b + a)
    elif S[i] == "-":
        a = pop()
        b = pop()
        push(b - a)
    elif S[i] == "*":
        a = pop()
        b = pop()
        push(b * a)
    elif S[i] == "/":
        a = pop()
        b = pop()
        push(b / a)
    else:
        push(int(S[i]))

print Stack.pop(-1) S = raw_input().split(" ") S raw_input().split(" ") ().split () raw_input split " " Stack = list() Stack list() list def push(x):
    Stack.append(x) push Stack.append(x) Stack.append Stack append x x x def pop():
    return Stack.pop(-1) pop return Stack.pop(-1) Stack.pop(-1) Stack.pop Stack pop -1 a = 0 a 0 b = 0 b 0 for i in range(len(S)):
    if S[i] == "+":
        a = pop()
        b = pop()
        push(b + a)
    elif S[i] == "-":
        a = pop()
        b = pop()
        push(b - a)
    elif S[i] == "*":
        a = pop()
        b = pop()
        push(b * a)
    elif S[i] == "/":
        a = pop()
        b = pop()
        push(b / a)
    else:
        push(int(S[i])) i range(len(S)) range len(S) len S if S[i] == "+":
        a = pop()
        b = pop()
        push(b + a)
    elif S[i] == "-":
        a = pop()
        b = pop()
        push(b - a)
    elif S[i] == "*":
        a = pop()
        b = pop()
        push(b * a)
    elif S[i] == "/":
        a = pop()
        b = pop()
        push(b / a)
    else:
        push(int(S[i])) S[i] == "+" S[i] S i "+" a = pop() a pop() pop b = pop() b pop() pop push(b + a) push b + a b a elif S[i] == "-":
        a = pop()
        b = pop()
        push(b - a)
     S[i] == "-" S[i] S i "-" a = pop() a pop() pop b = pop() b pop() pop push(b - a) push b - a b a elif S[i] == "*":
        a = pop()
        b = pop()
        push(b * a)
     S[i] == "*" S[i] S i "*" a = pop() a pop() pop b = pop() b pop() pop push(b * a) push b * a b a elif S[i] == "/":
        a = pop()
        b = pop()
        push(b / a)
     S[i] == "/" S[i] S i "/" a = pop() a pop() pop b = pop() b pop() pop push(b / a) push b / a b a push(int(S[i])) push int(S[i]) int S[i] S i print Stack.pop(-1) Stack.pop Stack pop -1 a = 0 0 a b = 0 0 b b = pop() pop() b a = pop() pop() a S = raw_input().split(" ") raw_input().split(" ") S b = pop() pop() b a = pop() pop() a def pop():
    return Stack.pop(-1) def pop():
    return Stack.pop(-1) pop a = pop() pop() a b = pop() pop() b b = pop() pop() b Stack = list() list() Stack def push(x):
    Stack.append(x) def push(x):
    Stack.append(x) push a = pop() pop() a
S = raw_input().split(" ")
Stack = list()

def push(x):
    Stack.append(x)

def pop():
    return Stack.pop(-1)

a = 0
b = 0
for i in range(len(S)):
    if S[i] == "+":
        a = pop()
        b = pop()
        push(b + a)
    elif S[i] == "-":
        a = pop()
        b = pop()
        push(b - a)
    elif S[i] == "*":
        a = pop()
        b = pop()
        push(b * a)
    elif S[i] == "/":
        a = pop()
        b = pop()
        push(b / a)
    else:
        push(int(S[i]))

print Stack.pop(-1)