s=list(input().split())
a=[]
for x in s:
    if x in ['+','-','*']:
        c,b=str(a.pop()),str(a.pop())
        b+=x+c
        a+=[int(eval(b))]
    else:a+=[int(x)]
print(a.pop()) s=list(input().split()) s list(input().split()) list input().split() ().split () input split a=[] a [] for x in s:
    if x in ['+','-','*']:
        c,b=str(a.pop()),str(a.pop())
        b+=x+c
        a+=[int(eval(b))]
    else:a+=[int(x)] x s if x in ['+','-','*']:
        c,b=str(a.pop()),str(a.pop())
        b+=x+c
        a+=[int(eval(b))]
    else:a+=[int(x)] x in ['+','-','*'] x ['+','-','*'] '+' '-' '*' c,b=str(a.pop()),str(a.pop()) c str(a.pop()) str a.pop() a.pop a pop b str(a.pop()) str a.pop() a.pop a pop b+=x+c b x+c x c a+=[int(eval(b))] a [int(eval(b))] int(eval(b)) int eval(b) eval b print(a.pop()) print a.pop() a.pop a pop s=list(input().split()) list(input().split()) s b=str(a.pop()),str(a.pop()) str(a.pop()) b c,b=str(a.pop()),str(a.pop()) str(a.pop()) c b+=x+c x+c b a+=[int(eval(b))] [int(eval(b))] a a=[] [] a
s=list(input().split())
a=[]
for x in s:
    if x in ['+','-','*']:
        c,b=str(a.pop()),str(a.pop())
        b+=x+c
        a+=[int(eval(b))]
    else:a+=[int(x)]
print(a.pop())