
Stack=[]
def push(x):
    Stack.append(x)

def pop():
    return Stack.pop()

def solve():
    s_list=raw_input().split()
    for i in range(len(s_list)):
        if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
    print(pop())

def main():
    if __name__=="__main__":
        solve()

main() Stack=[] Stack [] def push(x):
    Stack.append(x) push Stack.append(x) Stack.append Stack append x x x def pop():
    return Stack.pop() pop return Stack.pop() Stack.pop() Stack.pop Stack pop def solve():
    s_list=raw_input().split()
    for i in range(len(s_list)):
        if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
    print(pop()) solve s_list=raw_input().split() s_list raw_input().split() ().split () raw_input split for i in range(len(s_list)):
        if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
     i range(len(s_list)) range len(s_list) len s_list if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
     s_list[i]=='+' s_list[i] s_list i '+' b=pop() b pop() pop a=pop() a pop() pop push(a+b) push a+b a b elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
         s_list[i]=='-' s_list[i] s_list i '-' b=pop() b pop() pop a=pop() a pop() pop push(a-b) push a-b a b elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
         s_list[i]=='*' s_list[i] s_list i '*' b=pop() b pop() pop a=pop() a pop() pop push(a*b) push a*b a b push(int(s_list[i])) push int(s_list[i]) int s_list[i] s_list i print(pop()) print pop() pop def main():
    if __name__=="__main__":
        solve() main if __name__=="__main__":
        solve() __name__=="__main__" __name__ "__main__" solve() solve main() main def push(x):
    Stack.append(x) def push(x):
    Stack.append(x) push def solve():
    s_list=raw_input().split()
    for i in range(len(s_list)):
        if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
    print(pop()) def solve():
    s_list=raw_input().split()
    for i in range(len(s_list)):
        if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
    print(pop()) solve def pop():
    return Stack.pop() def pop():
    return Stack.pop() pop Stack=[] [] Stack def main():
    if __name__=="__main__":
        solve() def main():
    if __name__=="__main__":
        solve() main

Stack=[]
def push(x):
    Stack.append(x)

def pop():
    return Stack.pop()

def solve():
    s_list=raw_input().split()
    for i in range(len(s_list)):
        if s_list[i]=='+':
            b=pop()
            a=pop()
            push(a+b)
        elif s_list[i]=='-':
            b=pop()
            a=pop()
            push(a-b)
        elif s_list[i]=='*':
            b=pop()
            a=pop()
            push(a*b)
        else:
            push(int(s_list[i]))
    print(pop())

def main():
    if __name__=="__main__":
        solve()

main()