arguments = input().split()

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))


print(array.pop()) arguments = input().split() arguments input().split() ().split () input split array = [] array [] for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word)) word arguments if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word)) word == '-' word '-' s1 = array.pop() s1 array.pop() array.pop array pop s2 = array.pop() s2 array.pop() array.pop array pop array.append(s2-s1) array.append array append s2-s1 s2 s1 elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
     word == '*' word '*' s1 =array.pop() s1 array.pop() array.pop array pop s2 = array.pop() s2 array.pop() array.pop array pop array.append(s1*s2) array.append array append s1*s2 s1 s2 elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
     word == '+' word '+' s1 = array.pop() s1 array.pop() array.pop array pop s2 = array.pop() s2 array.pop() array.pop array pop array.append(s1+s2) array.append array append s1+s2 s1 s2 array.append(int(word)) array.append array append int(word) int word print(array.pop()) print array.pop() array.pop array pop s2 = array.pop() array.pop() s2 s1 = array.pop() array.pop() s1 arguments = input().split() input().split() arguments s1 =array.pop() array.pop() s1 s2 = array.pop() array.pop() s2 array = [] [] array s2 = array.pop() array.pop() s2 s1 = array.pop() array.pop() s1
arguments = input().split()

array = []

for word in arguments:
    if word == '-':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s2-s1)
    elif word == '*':
        s1 =array.pop()
        s2 = array.pop()
        array.append(s1*s2)
    elif word == '+':
        s1 = array.pop()
        s2 = array.pop()
        array.append(s1+s2)
    else:
        array.append(int(word))


print(array.pop())