hoge = list()
for elem in (elem for elem in input().split()):
    if elem == '+':
        elem = int(hoge.pop()) + int(hoge.pop())
    elif elem == '*':
        elem = int(hoge.pop()) * int(hoge.pop())
    elif elem == '-':
        elem = -1*int(hoge.pop()) + int(hoge.pop())
    hoge.append(elem)
print (elem) hoge = list() hoge list() list for elem in (elem for elem in input().split()):
    if elem == '+':
        elem = int(hoge.pop()) + int(hoge.pop())
    elif elem == '*':
        elem = int(hoge.pop()) * int(hoge.pop())
    elif elem == '-':
        elem = -1*int(hoge.pop()) + int(hoge.pop())
    hoge.append(elem) elem (elem for elem in input().split()) if elem == '+':
        elem = int(hoge.pop()) + int(hoge.pop())
    elif elem == '*':
        elem = int(hoge.pop()) * int(hoge.pop())
    elif elem == '-':
        elem = -1*int(hoge.pop()) + int(hoge.pop())
     elem == '+' elem '+' elem = int(hoge.pop()) + int(hoge.pop()) elem int(hoge.pop()) + int(hoge.pop()) int(hoge.pop()) int hoge.pop() hoge.pop hoge pop int(hoge.pop()) int hoge.pop() hoge.pop hoge pop elif elem == '*':
        elem = int(hoge.pop()) * int(hoge.pop())
     elem == '*' elem '*' elem = int(hoge.pop()) * int(hoge.pop()) elem int(hoge.pop()) * int(hoge.pop()) int(hoge.pop()) int hoge.pop() hoge.pop hoge pop int(hoge.pop()) int hoge.pop() hoge.pop hoge pop elif elem == '-':
        elem = -1*int(hoge.pop()) + int(hoge.pop())
     elem == '-' elem '-' elem = -1*int(hoge.pop()) + int(hoge.pop()) elem -1*int(hoge.pop()) + int(hoge.pop()) -1*int(hoge.pop()) -1 int(hoge.pop()) int hoge.pop() hoge.pop hoge pop int(hoge.pop()) int hoge.pop() hoge.pop hoge pop hoge.append(elem) hoge.append hoge append elem print (elem) print elem elem = -1*int(hoge.pop()) + int(hoge.pop()) -1*int(hoge.pop()) + int(hoge.pop()) elem elem = int(hoge.pop()) * int(hoge.pop()) int(hoge.pop()) * int(hoge.pop()) elem hoge = list() list() hoge elem = int(hoge.pop()) + int(hoge.pop()) int(hoge.pop()) + int(hoge.pop()) elem
hoge = list()
for elem in (elem for elem in input().split()):
    if elem == '+':
        elem = int(hoge.pop()) + int(hoge.pop())
    elif elem == '*':
        elem = int(hoge.pop()) * int(hoge.pop())
    elif elem == '-':
        elem = -1*int(hoge.pop()) + int(hoge.pop())
    hoge.append(elem)
print (elem)
