def calculator(op, x, y):
    if op == '+':
        return x + y
    elif op == '-':
        return y - x
    else:
        return x * y


raw = [r for r in input().split()]
for i in range(len(raw)):
    try:
        raw[i] = int(raw[i])
    except:
        continue

arr = []
buff = 0
for i in range(len(raw)):
    if isinstance(raw[i], int):
        arr.append(raw[i])
    else:
        buff = calculator(raw[i], arr.pop(), arr.pop())
        arr.append(buff)

print(*arr)
 def calculator(op, x, y):
    if op == '+':
        return x + y
    elif op == '-':
        return y - x
    else:
        return x * y calculator if op == '+':
        return x + y
    elif op == '-':
        return y - x
    else:
        return x * y op == '+' op '+' return x + y x + y x y elif op == '-':
        return y - x
     op == '-' op '-' return y - x y - x y x return x * y x * y x y op op x x y y r for r in input().split() for r in input().split() r input().split() ().split () input split for r in input().split() r raw = [r for r in input().split()] raw [r for r in input().split()] for i in range(len(raw)):
    try:
        raw[i] = int(raw[i])
    except:
        continue i range(len(raw)) range len(raw) len raw try:
        raw[i] = int(raw[i])
    except:
        continue except:
        continue continue raw[i] = int(raw[i]) raw[i] raw i int(raw[i]) int raw[i] raw i arr = [] arr [] buff = 0 buff 0 for i in range(len(raw)):
    if isinstance(raw[i], int):
        arr.append(raw[i])
    else:
        buff = calculator(raw[i], arr.pop(), arr.pop())
        arr.append(buff) i range(len(raw)) range len(raw) len raw if isinstance(raw[i], int):
        arr.append(raw[i])
    else:
        buff = calculator(raw[i], arr.pop(), arr.pop())
        arr.append(buff) isinstance(raw[i], int) isinstance raw[i] raw i int arr.append(raw[i]) arr.append arr append raw[i] raw i buff = calculator(raw[i], arr.pop(), arr.pop()) buff calculator(raw[i], arr.pop(), arr.pop()) calculator raw[i] raw i arr.pop() arr.pop arr pop arr.pop() arr.pop arr pop arr.append(buff) arr.append arr append buff print(*arr) print *arr arr raw = [r for r in input().split()] [r for r in input().split()] raw arr = [] [] arr buff = 0 0 buff def calculator(op, x, y):
    if op == '+':
        return x + y
    elif op == '-':
        return y - x
    else:
        return x * y def calculator(op, x, y):
    if op == '+':
        return x + y
    elif op == '-':
        return y - x
    else:
        return x * y calculator buff = calculator(raw[i], arr.pop(), arr.pop()) calculator(raw[i], arr.pop(), arr.pop()) buff
def calculator(op, x, y):
    if op == '+':
        return x + y
    elif op == '-':
        return y - x
    else:
        return x * y


raw = [r for r in input().split()]
for i in range(len(raw)):
    try:
        raw[i] = int(raw[i])
    except:
        continue

arr = []
buff = 0
for i in range(len(raw)):
    if isinstance(raw[i], int):
        arr.append(raw[i])
    else:
        buff = calculator(raw[i], arr.pop(), arr.pop())
        arr.append(buff)

print(*arr)

