box = []
elem = input().split()
for i in elem:
    if i == '+' or i == '-' or i =='*':
        v = '{0} {1} {2}'.format(box[-2],i,box[-1])
        box.pop()
        box.pop()
        box.append(eval(v))
    else:
        box.append(i)
print (box[0]) box = [] box [] elem = input().split() elem input().split() ().split () input split for i in elem:
    if i == '+' or i == '-' or i =='*':
        v = '{0} {1} {2}'.format(box[-2],i,box[-1])
        box.pop()
        box.pop()
        box.append(eval(v))
    else:
        box.append(i) i elem if i == '+' or i == '-' or i =='*':
        v = '{0} {1} {2}'.format(box[-2],i,box[-1])
        box.pop()
        box.pop()
        box.append(eval(v))
    else:
        box.append(i) i == '+' or i == '-' or i =='*' i == '+' or i == '-' i == '+' i '+' i == '-' i '-' i =='*' i '*' v = '{0} {1} {2}'.format(box[-2],i,box[-1]) v '{0} {1} {2}'.format(box[-2],i,box[-1]) '{0} {1} {2}'.format '{0} {1} {2}' format box[-2] box -2 i box[-1] box -1 box.pop() box.pop box pop box.pop() box.pop box pop box.append(eval(v)) box.append box append eval(v) eval v box.append(i) box.append box append i print (box[0]) print box[0] box 0 elem = input().split() input().split() elem v = '{0} {1} {2}'.format(box[-2],i,box[-1]) '{0} {1} {2}'.format(box[-2],i,box[-1]) v box = [] [] box
box = []
elem = input().split()
for i in elem:
    if i == '+' or i == '-' or i =='*':
        v = '{0} {1} {2}'.format(box[-2],i,box[-1])
        box.pop()
        box.pop()
        box.append(eval(v))
    else:
        box.append(i)
print (box[0])