# stack
exp = input().split()
s = []

for lt in exp:
    if lt == '+' or lt == '-' or lt == '*':
        rhs = s.pop()
        lhs = s.pop()
        if lt == '+':
            s.append(lhs + rhs)
        if lt == '*':
            s.append(lhs * rhs)
        if lt == '-':
            s.append(lhs - rhs)
    else:
        s.append(int(lt))
        
print(str(s[0])) exp = input().split() exp input().split() ().split () input split s = [] s [] for lt in exp:
    if lt == '+' or lt == '-' or lt == '*':
        rhs = s.pop()
        lhs = s.pop()
        if lt == '+':
            s.append(lhs + rhs)
        if lt == '*':
            s.append(lhs * rhs)
        if lt == '-':
            s.append(lhs - rhs)
    else:
        s.append(int(lt))
         lt exp if lt == '+' or lt == '-' or lt == '*':
        rhs = s.pop()
        lhs = s.pop()
        if lt == '+':
            s.append(lhs + rhs)
        if lt == '*':
            s.append(lhs * rhs)
        if lt == '-':
            s.append(lhs - rhs)
    else:
        s.append(int(lt))
         lt == '+' or lt == '-' or lt == '*' lt == '+' or lt == '-' lt == '+' lt '+' lt == '-' lt '-' lt == '*' lt '*' rhs = s.pop() rhs s.pop() s.pop s pop lhs = s.pop() lhs s.pop() s.pop s pop if lt == '+':
            s.append(lhs + rhs)
         lt == '+' lt '+' s.append(lhs + rhs) s.append s append lhs + rhs lhs rhs if lt == '*':
            s.append(lhs * rhs)
         lt == '*' lt '*' s.append(lhs * rhs) s.append s append lhs * rhs lhs rhs if lt == '-':
            s.append(lhs - rhs)
     lt == '-' lt '-' s.append(lhs - rhs) s.append s append lhs - rhs lhs rhs s.append(int(lt)) s.append s append int(lt) int lt print(str(s[0])) print str(s[0]) str s[0] s 0 exp = input().split() input().split() exp lhs = s.pop() s.pop() lhs rhs = s.pop() s.pop() rhs s = [] [] s
# stack
exp = input().split()
s = []

for lt in exp:
    if lt == '+' or lt == '-' or lt == '*':
        rhs = s.pop()
        lhs = s.pop()
        if lt == '+':
            s.append(lhs + rhs)
        if lt == '*':
            s.append(lhs * rhs)
        if lt == '-':
            s.append(lhs - rhs)
    else:
        s.append(int(lt))
        
print(str(s[0]))