if __name__=="__main__":
    a = list(input().split())
    b = []
    for i in range(len(a)):
        if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
    print(b[0]) if __name__=="__main__":
    a = list(input().split())
    b = []
    for i in range(len(a)):
        if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
    print(b[0]) __name__=="__main__" __name__ "__main__" a = list(input().split()) a list(input().split()) list input().split() ().split () input split b = [] b [] for i in range(len(a)):
        if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
     i range(len(a)) range len(a) len a if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
     a[i] == "+" a[i] a i "+" y = b.pop() y b.pop() b.pop b pop x = b.pop() x b.pop() b.pop b pop z = x + y z x + y x y b.append(z) b.append b append z elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
         a[i] == "-" a[i] a i "-" y = b.pop() y b.pop() b.pop b pop x = b.pop() x b.pop() b.pop b pop z = x - y z x - y x y b.append(z) b.append b append z elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
         a[i] == "*" a[i] a i "*" y = b.pop() y b.pop() b.pop b pop x = b.pop() x 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(a[i])) b.append b append int(a[i]) int a[i] a i print(b[0]) print b[0] b 0 x = b.pop() b.pop() x b = [] [] b z = x - y x - y z z = x + y x + y z y = b.pop() b.pop() y y = b.pop() b.pop() y y = b.pop() b.pop() y z = x * y x * y z a = list(input().split()) list(input().split()) a x = b.pop() b.pop() x x = b.pop() b.pop() x
if __name__=="__main__":
    a = list(input().split())
    b = []
    for i in range(len(a)):
        if a[i] == "+":
            y = b.pop()
            x = b.pop()
            z = x + y
            b.append(z)
        elif a[i] == "-":
            y = b.pop()
            x = b.pop()
            z = x - y
            b.append(z)
        elif a[i] == "*":
            y = b.pop()
            x = b.pop()
            z = x * y
            b.append(z)
        else:
            b.append(int(a[i]))
    print(b[0])