class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1]


def main():
    e = input().split()
    s = Stack(101)

    for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

    print(s.pop())


if __name__ == '__main__':
    main()
 class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] Stack def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

     __init__ self.stack = [None] * full_idx self.stack self stack [None] * full_idx [None] None full_idx self.top = 0 self.top self top 0 self.MAX = full_idx self.MAX self MAX full_idx self self full_idx=10 full_idx 10 def is_empty(self):
        return self.top == 0

     is_empty return self.top == 0 self.top == 0 self.top self top 0 self self def is_full(self):
        return self.top >= self.MAX - 1

     is_full return self.top >= self.MAX - 1 self.top >= self.MAX - 1 self.top self top self.MAX - 1 self.MAX self MAX 1 self self def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

     push if self.is_full():
            raise IndexError

         self.is_full() self.is_full self is_full raise IndexError IndexError self.top += 1 self.top self top 1 self.stack[self.top] = x self.stack[self.top] self.stack self stack self.top self top x self self x x def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] pop if self.is_empty():
            raise IndexError

         self.is_empty() self.is_empty self is_empty raise IndexError IndexError self.top -= 1 self.top self top 1 return self.stack[self.top+1] self.stack[self.top+1] self.stack self stack self.top+1 self.top self top 1 self self def main():
    e = input().split()
    s = Stack(101)

    for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

    print(s.pop()) main e = input().split() e input().split() ().split () input split s = Stack(101) s Stack(101) Stack 101 for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

     i range(len(e)) range len(e) len e if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

     e[i].isdigit() [i].isdigit [i] e i isdigit s.push(int(e[i])) s.push s push int(e[i]) int e[i] e i elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
         e[i] == '+' e[i] e i '+' a, b = s.pop(), s.pop() a s.pop() s.pop s pop b s.pop() s.pop s pop s.push(a+b) s.push s push a+b a b elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
         e[i] == '-' e[i] e i '-' a, b = s.pop(), s.pop() a s.pop() s.pop s pop b s.pop() s.pop s pop s.push(b-a) s.push s push b-a b a a, b = s.pop(), s.pop() a s.pop() s.pop s pop b s.pop() s.pop s pop s.push(a*b) s.push s push a*b a b print(s.pop()) print s.pop() s.pop s pop if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1] Stack def main():
    e = input().split()
    s = Stack(101)

    for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

    print(s.pop()) def main():
    e = input().split()
    s = Stack(101)

    for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

    print(s.pop()) main
class Stack:
    def __init__(self, full_idx=10):
        self.stack = [None] * full_idx
        self.top = 0
        self.MAX = full_idx

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.MAX - 1

    def push(self, x):
        if self.is_full():
            raise IndexError

        self.top += 1
        self.stack[self.top] = x

    def pop(self):
        if self.is_empty():
            raise IndexError

        self.top -= 1
        return self.stack[self.top+1]


def main():
    e = input().split()
    s = Stack(101)

    for i in range(len(e)):
        if e[i].isdigit():
            s.push(int(e[i]))
        elif e[i] == '+':
            a, b = s.pop(), s.pop()
            s.push(a+b)
        elif e[i] == '-':
            a, b = s.pop(), s.pop()
            s.push(b-a)
        else:
            a, b = s.pop(), s.pop()
            s.push(a*b)

    print(s.pop())


if __name__ == '__main__':
    main()

