# your code goes here
#polland
def nu(x):
    if x=="+" or x=="-" or x=="*":
        return 0
    else:
        return 1
def c(a,b,l):
    if l=="+":
        d=a+b
    elif l=="-":
        d=a-b
    else:
        d=a*b
    return d
F=[i for i in input().split()]
i=0
S=[]
while i<len(F):
    if nu(F[i])==0:
        S[-2]=c(S[-2],S[-1],F[i])
        S.pop(-1)
    else:
        S.append(int(F[i]))
    i+=1
print(S[0]) def nu(x):
    if x=="+" or x=="-" or x=="*":
        return 0
    else:
        return 1 nu if x=="+" or x=="-" or x=="*":
        return 0
    else:
        return 1 x=="+" or x=="-" or x=="*" x=="+" or x=="-" x=="+" x "+" x=="-" x "-" x=="*" x "*" return 0 0 return 1 1 x x def c(a,b,l):
    if l=="+":
        d=a+b
    elif l=="-":
        d=a-b
    else:
        d=a*b
    return d c if l=="+":
        d=a+b
    elif l=="-":
        d=a-b
    else:
        d=a*b
     l=="+" l "+" d=a+b d a+b a b elif l=="-":
        d=a-b
     l=="-" l "-" d=a-b d a-b a b d=a*b d a*b a b return d d a a b b l l i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i F=[i for i in input().split()] F [i for i in input().split()] i=0 i 0 S=[] S [] while i<len(F):
    if nu(F[i])==0:
        S[-2]=c(S[-2],S[-1],F[i])
        S.pop(-1)
    else:
        S.append(int(F[i]))
    i+=1 i<len(F) i len(F) len F if nu(F[i])==0:
        S[-2]=c(S[-2],S[-1],F[i])
        S.pop(-1)
    else:
        S.append(int(F[i]))
     nu(F[i])==0 nu(F[i]) nu F[i] F i 0 S[-2]=c(S[-2],S[-1],F[i]) S[-2] S -2 c(S[-2],S[-1],F[i]) c S[-2] S -2 S[-1] S -1 F[i] F i S.pop(-1) S.pop S pop -1 S.append(int(F[i])) S.append S append int(F[i]) int F[i] F i i+=1 i 1 print(S[0]) print S[0] S 0 i=0 0 i i+=1 1 i def c(a,b,l):
    if l=="+":
        d=a+b
    elif l=="-":
        d=a-b
    else:
        d=a*b
    return d def c(a,b,l):
    if l=="+":
        d=a+b
    elif l=="-":
        d=a-b
    else:
        d=a*b
    return d c F=[i for i in input().split()] [i for i in input().split()] F S=[] [] S def nu(x):
    if x=="+" or x=="-" or x=="*":
        return 0
    else:
        return 1 def nu(x):
    if x=="+" or x=="-" or x=="*":
        return 0
    else:
        return 1 nu
# your code goes here
#polland
def nu(x):
    if x=="+" or x=="-" or x=="*":
        return 0
    else:
        return 1
def c(a,b,l):
    if l=="+":
        d=a+b
    elif l=="-":
        d=a-b
    else:
        d=a*b
    return d
F=[i for i in input().split()]
i=0
S=[]
while i<len(F):
    if nu(F[i])==0:
        S[-2]=c(S[-2],S[-1],F[i])
        S.pop(-1)
    else:
        S.append(int(F[i]))
    i+=1
print(S[0])