from collections import deque

if __name__ == '__main__':
    x = [(int)(x) if x.isdigit() else x for x in input().split()]
    
    y = deque()

    for tmp in x:
        if tmp == '+':
            a = y.pop()
            b = y.pop()
            y.append(a+b)
        elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
        elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
        elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
        else:
            y.append(tmp)

    print(y.pop()) from collections import deque if __name__ == '__main__':
    x = [(int)(x) if x.isdigit() else x for x in input().split()]
    
    y = deque()

    for tmp in x:
        if tmp == '+':
            a = y.pop()
            b = y.pop()
            y.append(a+b)
        elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
        elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
        elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
        else:
            y.append(tmp)

    print(y.pop()) __name__ == '__main__' __name__ '__main__' (int)(x) if x.isdigit() else x for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() (int)(x) if x.isdigit() else x x.isdigit() x.isdigit x isdigit (int)(x) int x x x = [(int)(x) if x.isdigit() else x for x in input().split()] x [(int)(x) if x.isdigit() else x for x in input().split()] y = deque() y deque() deque for tmp in x:
        if tmp == '+':
            a = y.pop()
            b = y.pop()
            y.append(a+b)
        elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
        elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
        elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
        else:
            y.append(tmp)

     tmp x if tmp == '+':
            a = y.pop()
            b = y.pop()
            y.append(a+b)
        elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
        elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
        elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
        else:
            y.append(tmp)

     tmp == '+' tmp '+' a = y.pop() a y.pop() y.pop y pop b = y.pop() b y.pop() y.pop y pop y.append(a+b) y.append y append a+b a b elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
         tmp == '-' tmp '-' a = y.pop() a y.pop() y.pop y pop b = y.pop() b y.pop() y.pop y pop y.append(b-a) y.append y append b-a b a elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
         tmp == '*' tmp '*' a = y.pop() a y.pop() y.pop y pop b = y.pop() b y.pop() y.pop y pop y.append(a*b) y.append y append a*b a b elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
         tmp == '/' tmp '/' a = y.pop() a y.pop() y.pop y pop b = y.pop() b y.pop() y.pop y pop y.append(b//a) y.append y append b//a b a y.append(tmp) y.append y append tmp print(y.pop()) print y.pop() y.pop y pop a = y.pop() y.pop() a y = deque() deque() y a = y.pop() y.pop() a b = y.pop() y.pop() b b = y.pop() y.pop() b a = y.pop() y.pop() a b = y.pop() y.pop() b a = y.pop() y.pop() a x = [(int)(x) if x.isdigit() else x for x in input().split()] [(int)(x) if x.isdigit() else x for x in input().split()] x b = y.pop() y.pop() b
from collections import deque

if __name__ == '__main__':
    x = [(int)(x) if x.isdigit() else x for x in input().split()]
    
    y = deque()

    for tmp in x:
        if tmp == '+':
            a = y.pop()
            b = y.pop()
            y.append(a+b)
        elif tmp == '-':
            a = y.pop()
            b = y.pop()
            y.append(b-a)
        elif tmp == '*':
            a = y.pop()
            b = y.pop()
            y.append(a*b)
        elif tmp == '/':
            a = y.pop()
            b = y.pop()
            y.append(b//a)
        else:
            y.append(tmp)

    print(y.pop())