# coding: utf-8
from collections import deque

inputs = deque(raw_input().split())
q = deque()
while len(inputs):
    op = inputs.popleft()
    if op == '+':
        q.append(q.pop() + q.pop())
    elif op == '-':
        v1 = q.pop()
        v2 = q.pop()
        q.append(v2 - v1)
    elif op == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(op))

print q.pop()
 from collections import deque inputs = deque(raw_input().split()) inputs deque(raw_input().split()) deque raw_input().split() ().split () raw_input split q = deque() q deque() deque while len(inputs):
    op = inputs.popleft()
    if op == '+':
        q.append(q.pop() + q.pop())
    elif op == '-':
        v1 = q.pop()
        v2 = q.pop()
        q.append(v2 - v1)
    elif op == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(op)) len(inputs) len inputs op = inputs.popleft() op inputs.popleft() inputs.popleft inputs popleft if op == '+':
        q.append(q.pop() + q.pop())
    elif op == '-':
        v1 = q.pop()
        v2 = q.pop()
        q.append(v2 - v1)
    elif op == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(op)) op == '+' op '+' 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 op == '-':
        v1 = q.pop()
        v2 = q.pop()
        q.append(v2 - v1)
     op == '-' op '-' v1 = q.pop() v1 q.pop() q.pop q pop v2 = q.pop() v2 q.pop() q.pop q pop q.append(v2 - v1) q.append q append v2 - v1 v2 v1 elif op == '*':
        q.append(q.pop() * q.pop())
     op == '*' op '*' 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(op)) q.append q append int(op) int op print q.pop() q.pop q pop v2 = q.pop() q.pop() v2 q = deque() deque() q op = inputs.popleft() inputs.popleft() op v1 = q.pop() q.pop() v1 inputs = deque(raw_input().split()) deque(raw_input().split()) inputs
# coding: utf-8
from collections import deque

inputs = deque(raw_input().split())
q = deque()
while len(inputs):
    op = inputs.popleft()
    if op == '+':
        q.append(q.pop() + q.pop())
    elif op == '-':
        v1 = q.pop()
        v2 = q.pop()
        q.append(v2 - v1)
    elif op == '*':
        q.append(q.pop() * q.pop())
    else:
        q.append(int(op))

print q.pop()

