l = input().split()
q = []

for e in l:
    if e == '+':
        q.append(q.pop() + q.pop())
    elif e == '-':
        q.append(-q.pop() + q.pop())
    elif e == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(e))

print(q[0]) l = input().split() l input().split() ().split () input split q = [] q [] for e in l:
    if e == '+':
        q.append(q.pop() + q.pop())
    elif e == '-':
        q.append(-q.pop() + q.pop())
    elif e == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(e)) e l if e == '+':
        q.append(q.pop() + q.pop())
    elif e == '-':
        q.append(-q.pop() + q.pop())
    elif e == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(e)) e == '+' e '+' q.append(q.pop() + q.pop()) q.append q append q.pop() + q.pop() q.pop() q.pop q pop q.pop() q.pop q pop elif e == '-':
        q.append(-q.pop() + q.pop())
     e == '-' e '-' q.append(-q.pop() + q.pop()) q.append q append -q.pop() + q.pop() -q.pop() q.pop() q.pop q pop q.pop() q.pop q pop elif e == '*':
        q.append(q.pop() * q.pop())
     e == '*' e '*' q.append(q.pop() * q.pop()) q.append q append q.pop() * q.pop() q.pop() q.pop q pop q.pop() q.pop q pop q.append(int(e)) q.append q append int(e) int e print(q[0]) print q[0] q 0 q = [] [] q l = input().split() input().split() l
l = input().split()
q = []

for e in l:
    if e == '+':
        q.append(q.pop() + q.pop())
    elif e == '-':
        q.append(-q.pop() + q.pop())
    elif e == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(e))

print(q[0])