stack = input().split()
temp  =  []
num=0
for loop in stack:
    a = loop
    if a is "+":
        num = temp.pop() + temp.pop()
        temp.append(num)
    elif a is "-":
        b=temp.pop()
        c=temp.pop()
        num = c-b
        temp.append(num)
    elif a is "*":
        num = temp.pop() * temp.pop()
        temp.append(num)
    else:
        temp .append(int(a))

print(temp[0]) stack = input().split() stack input().split() ().split () input split temp  =  [] temp [] num=0 num 0 for loop in stack:
    a = loop
    if a is "+":
        num = temp.pop() + temp.pop()
        temp.append(num)
    elif a is "-":
        b=temp.pop()
        c=temp.pop()
        num = c-b
        temp.append(num)
    elif a is "*":
        num = temp.pop() * temp.pop()
        temp.append(num)
    else:
        temp .append(int(a)) loop stack a = loop a loop if a is "+":
        num = temp.pop() + temp.pop()
        temp.append(num)
    elif a is "-":
        b=temp.pop()
        c=temp.pop()
        num = c-b
        temp.append(num)
    elif a is "*":
        num = temp.pop() * temp.pop()
        temp.append(num)
    else:
        temp .append(int(a)) a is "+" a "+" num = temp.pop() + temp.pop() num temp.pop() + temp.pop() temp.pop() temp.pop temp pop temp.pop() temp.pop temp pop temp.append(num) temp.append temp append num elif a is "-":
        b=temp.pop()
        c=temp.pop()
        num = c-b
        temp.append(num)
     a is "-" a "-" b=temp.pop() b temp.pop() temp.pop temp pop c=temp.pop() c temp.pop() temp.pop temp pop num = c-b num c-b c b temp.append(num) temp.append temp append num elif a is "*":
        num = temp.pop() * temp.pop()
        temp.append(num)
     a is "*" a "*" num = temp.pop() * temp.pop() num temp.pop() * temp.pop() temp.pop() temp.pop temp pop temp.pop() temp.pop temp pop temp.append(num) temp.append temp append num temp .append(int(a)) temp .append temp append int(a) int a print(temp[0]) print temp[0] temp 0 c=temp.pop() temp.pop() c a = loop loop a num=0 0 num stack = input().split() input().split() stack temp  =  [] [] temp num = temp.pop() * temp.pop() temp.pop() * temp.pop() num num = temp.pop() + temp.pop() temp.pop() + temp.pop() num b=temp.pop() temp.pop() b num = c-b c-b num
stack = input().split()
temp  =  []
num=0
for loop in stack:
    a = loop
    if a is "+":
        num = temp.pop() + temp.pop()
        temp.append(num)
    elif a is "-":
        b=temp.pop()
        c=temp.pop()
        num = c-b
        temp.append(num)
    elif a is "*":
        num = temp.pop() * temp.pop()
        temp.append(num)
    else:
        temp .append(int(a))

print(temp[0])