rpn = map(str, raw_input().split())
stack = []

for i in rpn:
    if i.isdigit():
        stack.append(i)
    else:
        n1 = int( stack.pop() )
        n2 = int( stack.pop() )

    if   i == '+':
        stack.append( str(n2+n1) )
    elif i == '-':
        stack.append( str(n2-n1) )
    elif i == '*':
        stack.append( str(n2*n1) )

print stack[0] rpn = map(str, raw_input().split()) rpn map(str, raw_input().split()) map str raw_input().split() ().split () raw_input split stack = [] stack [] for i in rpn:
    if i.isdigit():
        stack.append(i)
    else:
        n1 = int( stack.pop() )
        n2 = int( stack.pop() )

    if   i == '+':
        stack.append( str(n2+n1) )
    elif i == '-':
        stack.append( str(n2-n1) )
    elif i == '*':
        stack.append( str(n2*n1) ) i rpn if i.isdigit():
        stack.append(i)
    else:
        n1 = int( stack.pop() )
        n2 = int( stack.pop() )

     i.isdigit() i.isdigit i isdigit stack.append(i) stack.append stack append i n1 = int( stack.pop() ) n1 int( stack.pop() ) int stack.pop() stack.pop stack pop n2 = int( stack.pop() ) n2 int( stack.pop() ) int stack.pop() stack.pop stack pop if   i == '+':
        stack.append( str(n2+n1) )
    elif i == '-':
        stack.append( str(n2-n1) )
    elif i == '*':
        stack.append( str(n2*n1) ) i == '+' i '+' stack.append( str(n2+n1) ) stack.append stack append str(n2+n1) str n2+n1 n2 n1 elif i == '-':
        stack.append( str(n2-n1) )
     i == '-' i '-' stack.append( str(n2-n1) ) stack.append stack append str(n2-n1) str n2-n1 n2 n1 elif i == '*':
        stack.append( str(n2*n1) ) i == '*' i '*' stack.append( str(n2*n1) ) stack.append stack append str(n2*n1) str n2*n1 n2 n1 print stack[0] stack 0 rpn = map(str, raw_input().split()) map(str, raw_input().split()) rpn n1 = int( stack.pop() ) int( stack.pop() ) n1 n2 = int( stack.pop() ) int( stack.pop() ) n2 stack = [] [] stack
rpn = map(str, raw_input().split())
stack = []

for i in rpn:
    if i.isdigit():
        stack.append(i)
    else:
        n1 = int( stack.pop() )
        n2 = int( stack.pop() )

    if   i == '+':
        stack.append( str(n2+n1) )
    elif i == '-':
        stack.append( str(n2-n1) )
    elif i == '*':
        stack.append( str(n2*n1) )

print stack[0]