a = [i for i in input().split()]

b = []
for i in a:
    if i == "+":
        x = int(b.pop())
        y = int(b.pop())
        z = x + y
        b.append(z)
    elif i == "-":
        x = int(b.pop())
        y = int(b.pop())
        z = y - x
        b.append(z)
    elif i == "*":
        x = int(b.pop())
        y = int(b.pop())
        z = x * y
        b.append(z)
    else:
        b.append(int(i))

print(b[0]) i for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() i a = [i for i in input().split()] a [i for i in input().split()] b = [] b [] for i in a:
    if i == "+":
        x = int(b.pop())
        y = int(b.pop())
        z = x + y
        b.append(z)
    elif i == "-":
        x = int(b.pop())
        y = int(b.pop())
        z = y - x
        b.append(z)
    elif i == "*":
        x = int(b.pop())
        y = int(b.pop())
        z = x * y
        b.append(z)
    else:
        b.append(int(i)) i a if i == "+":
        x = int(b.pop())
        y = int(b.pop())
        z = x + y
        b.append(z)
    elif i == "-":
        x = int(b.pop())
        y = int(b.pop())
        z = y - x
        b.append(z)
    elif i == "*":
        x = int(b.pop())
        y = int(b.pop())
        z = x * y
        b.append(z)
    else:
        b.append(int(i)) i == "+" i "+" x = int(b.pop()) x int(b.pop()) int b.pop() b.pop b pop y = int(b.pop()) y int(b.pop()) int b.pop() b.pop b pop z = x + y z x + y x y b.append(z) b.append b append z elif i == "-":
        x = int(b.pop())
        y = int(b.pop())
        z = y - x
        b.append(z)
     i == "-" i "-" x = int(b.pop()) x int(b.pop()) int b.pop() b.pop b pop y = int(b.pop()) y int(b.pop()) int b.pop() b.pop b pop z = y - x z y - x y x b.append(z) b.append b append z elif i == "*":
        x = int(b.pop())
        y = int(b.pop())
        z = x * y
        b.append(z)
     i == "*" i "*" x = int(b.pop()) x int(b.pop()) int b.pop() b.pop b pop y = int(b.pop()) y int(b.pop()) int b.pop() b.pop b pop z = x * y z x * y x y b.append(z) b.append b append z b.append(int(i)) b.append b append int(i) int i print(b[0]) print b[0] b 0 y = int(b.pop()) int(b.pop()) y x = int(b.pop()) int(b.pop()) x z = x * y x * y z x = int(b.pop()) int(b.pop()) x z = y - x y - x z y = int(b.pop()) int(b.pop()) y a = [i for i in input().split()] [i for i in input().split()] a b = [] [] b y = int(b.pop()) int(b.pop()) y z = x + y x + y z x = int(b.pop()) int(b.pop()) x
a = [i for i in input().split()]

b = []
for i in a:
    if i == "+":
        x = int(b.pop())
        y = int(b.pop())
        z = x + y
        b.append(z)
    elif i == "-":
        x = int(b.pop())
        y = int(b.pop())
        z = y - x
        b.append(z)
    elif i == "*":
        x = int(b.pop())
        y = int(b.pop())
        z = x * y
        b.append(z)
    else:
        b.append(int(i))

print(b[0])
