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

    while len(l) > 1:
        idx = 0
        while l[idx] not in ["+", "-", "*"]:
            idx += 1
        res = str(eval(str(l[idx-2] + l[idx] + l[idx-1])))
        l[idx-2] = res
        l.pop(idx-1)
        l.pop(idx-1)

    print(l[0])

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

    while len(l) > 1:
        idx = 0
        while l[idx] not in ["+", "-", "*"]:
            idx += 1
        res = str(eval(str(l[idx-2] + l[idx] + l[idx-1])))
        l[idx-2] = res
        l.pop(idx-1)
        l.pop(idx-1)

    print(l[0]) main l = input().split(' ') l input().split(' ') ().split () input split ' ' while len(l) > 1:
        idx = 0
        while l[idx] not in ["+", "-", "*"]:
            idx += 1
        res = str(eval(str(l[idx-2] + l[idx] + l[idx-1])))
        l[idx-2] = res
        l.pop(idx-1)
        l.pop(idx-1)

     len(l) > 1 len(l) len l 1 idx = 0 idx 0 while l[idx] not in ["+", "-", "*"]:
            idx += 1
         l[idx] not in ["+", "-", "*"] l[idx] l idx ["+", "-", "*"] "+" "-" "*" idx += 1 idx 1 res = str(eval(str(l[idx-2] + l[idx] + l[idx-1]))) res str(eval(str(l[idx-2] + l[idx] + l[idx-1]))) str eval(str(l[idx-2] + l[idx] + l[idx-1])) eval str(l[idx-2] + l[idx] + l[idx-1]) str l[idx-2] + l[idx] + l[idx-1] l[idx-2] + l[idx] l[idx-2] l idx-2 idx 2 l[idx] l idx l[idx-1] l idx-1 idx 1 l[idx-2] = res l[idx-2] l idx-2 idx 2 res l.pop(idx-1) l.pop l pop idx-1 idx 1 l.pop(idx-1) l.pop l pop idx-1 idx 1 print(l[0]) print l[0] l 0 main() main def main():
    l = input().split(' ')

    while len(l) > 1:
        idx = 0
        while l[idx] not in ["+", "-", "*"]:
            idx += 1
        res = str(eval(str(l[idx-2] + l[idx] + l[idx-1])))
        l[idx-2] = res
        l.pop(idx-1)
        l.pop(idx-1)

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

    while len(l) > 1:
        idx = 0
        while l[idx] not in ["+", "-", "*"]:
            idx += 1
        res = str(eval(str(l[idx-2] + l[idx] + l[idx-1])))
        l[idx-2] = res
        l.pop(idx-1)
        l.pop(idx-1)

    print(l[0]) main

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

    while len(l) > 1:
        idx = 0
        while l[idx] not in ["+", "-", "*"]:
            idx += 1
        res = str(eval(str(l[idx-2] + l[idx] + l[idx-1])))
        l[idx-2] = res
        l.pop(idx-1)
        l.pop(idx-1)

    print(l[0])

main()
