A = raw_input().split()
B = []
def add(x, y):
    return x + y
def sub(x, y):
    return x - y
def mul(x, y):
    return x * y
operation = {'+':add, '-':sub, '*':mul}
for item in A:
    if item.isdigit():
        B.append(int(item))
    else:
        num2 = B.pop() 
        num1 = B.pop()
        ans = operation[item](num1, num2)
        B.append(ans)
print ans A = raw_input().split() A raw_input().split() ().split () raw_input split B = [] B [] def add(x, y):
    return x + y add return x + y x + y x y x x y y def sub(x, y):
    return x - y sub return x - y x - y x y x x y y def mul(x, y):
    return x * y mul return x * y x * y x y x x y y operation = {'+':add, '-':sub, '*':mul} operation {'+':add, '-':sub, '*':mul} '+' '+' add '-' '-' sub '*' '*' mul for item in A:
    if item.isdigit():
        B.append(int(item))
    else:
        num2 = B.pop() 
        num1 = B.pop()
        ans = operation[item](num1, num2)
        B.append(ans) item A if item.isdigit():
        B.append(int(item))
    else:
        num2 = B.pop() 
        num1 = B.pop()
        ans = operation[item](num1, num2)
        B.append(ans) item.isdigit() item.isdigit item isdigit B.append(int(item)) B.append B append int(item) int item num2 = B.pop() num2 B.pop() B.pop B pop num1 = B.pop() num1 B.pop() B.pop B pop ans = operation[item](num1, num2) ans operation[item](num1, num2) [item] operation item num1 num2 B.append(ans) B.append B append ans print def sub(x, y):
    return x - y def sub(x, y):
    return x - y sub operation = {'+':add, '-':sub, '*':mul} {'+':add, '-':sub, '*':mul} operation num1 = B.pop() B.pop() num1 ans = operation[item](num1, num2) operation[item](num1, num2) ans num2 = B.pop() B.pop() num2 A = raw_input().split() raw_input().split() A B = [] [] B def mul(x, y):
    return x * y def mul(x, y):
    return x * y mul def add(x, y):
    return x + y def add(x, y):
    return x + y add
A = raw_input().split()
B = []
def add(x, y):
    return x + y
def sub(x, y):
    return x - y
def mul(x, y):
    return x * y
operation = {'+':add, '-':sub, '*':mul}
for item in A:
    if item.isdigit():
        B.append(int(item))
    else:
        num2 = B.pop() 
        num1 = B.pop()
        ans = operation[item](num1, num2)
        B.append(ans)
print ans