n = input().split()
array = []
for s in n:
    if s == "+" or s == "-" or s == "*":
        b = array.pop()
        a = array.pop()
        if   s == "+":
            array.append(a + b)
        elif s == "-":
            array.append(a - b)
        else:
            array.append(a * b)
    else:
        array.append(int(s))
print(array[0]) n = input().split() n input().split() ().split () input split array = [] array [] for s in n:
    if s == "+" or s == "-" or s == "*":
        b = array.pop()
        a = array.pop()
        if   s == "+":
            array.append(a + b)
        elif s == "-":
            array.append(a - b)
        else:
            array.append(a * b)
    else:
        array.append(int(s)) s n if s == "+" or s == "-" or s == "*":
        b = array.pop()
        a = array.pop()
        if   s == "+":
            array.append(a + b)
        elif s == "-":
            array.append(a - b)
        else:
            array.append(a * b)
    else:
        array.append(int(s)) s == "+" or s == "-" or s == "*" s == "+" or s == "-" s == "+" s "+" s == "-" s "-" s == "*" s "*" b = array.pop() b array.pop() array.pop array pop a = array.pop() a array.pop() array.pop array pop if   s == "+":
            array.append(a + b)
        elif s == "-":
            array.append(a - b)
        else:
            array.append(a * b)
     s == "+" s "+" array.append(a + b) array.append array append a + b a b elif s == "-":
            array.append(a - b)
         s == "-" s "-" array.append(a - b) array.append array append a - b a b array.append(a * b) array.append array append a * b a b array.append(int(s)) array.append array append int(s) int s print(array[0]) print array[0] array 0 a = array.pop() array.pop() a n = input().split() input().split() n array = [] [] array b = array.pop() array.pop() b
n = input().split()
array = []
for s in n:
    if s == "+" or s == "-" or s == "*":
        b = array.pop()
        a = array.pop()
        if   s == "+":
            array.append(a + b)
        elif s == "-":
            array.append(a - b)
        else:
            array.append(a * b)
    else:
        array.append(int(s))
print(array[0])