
def main():
    l = input().split(' ')

    s = []

    for el in l:
        if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

    print(s[0])

main() def main():
    l = input().split(' ')

    s = []

    for el in l:
        if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

    print(s[0]) main l = input().split(' ') l input().split(' ') ().split () input split ' ' s = [] s [] for el in l:
        if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

     el l if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

     el in ["+", "-", "*"] el ["+", "-", "*"] "+" "-" "*" a = s.pop(-1) a s.pop(-1) s.pop s pop -1 b = s.pop(-1) b s.pop(-1) s.pop s pop -1 s.append(eval(str(b) + el + str(a))) s.append s append eval(str(b) + el + str(a)) eval str(b) + el + str(a) str(b) + el str(b) str b el str(a) str a s.append(int(el)) s.append s append int(el) int el print(s[0]) print s[0] s 0 main() main def main():
    l = input().split(' ')

    s = []

    for el in l:
        if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

    print(s[0]) def main():
    l = input().split(' ')

    s = []

    for el in l:
        if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

    print(s[0]) main

def main():
    l = input().split(' ')

    s = []

    for el in l:
        if el in ["+", "-", "*"]:
            a = s.pop(-1)
            b = s.pop(-1)
            s.append(eval(str(b) + el + str(a)))
        else:
            s.append(int(el))

    print(s[0])

main()
