arr = list(map(str, input().split()))

i = 0

operand = []

while i < len(arr):
    if arr[i] == '+':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b + a)
    elif arr[i] == '-':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b - a)
    elif arr[i] == '*':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b * a)
    else:
        operand.append(int(arr[i]))
    i += 1

print(operand[0])
 arr = list(map(str, input().split())) arr list(map(str, input().split())) list map(str, input().split()) map str input().split() ().split () input split i = 0 i 0 operand = [] operand [] while i < len(arr):
    if arr[i] == '+':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b + a)
    elif arr[i] == '-':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b - a)
    elif arr[i] == '*':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b * a)
    else:
        operand.append(int(arr[i]))
    i += 1 i < len(arr) i len(arr) len arr if arr[i] == '+':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b + a)
    elif arr[i] == '-':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b - a)
    elif arr[i] == '*':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b * a)
    else:
        operand.append(int(arr[i]))
     arr[i] == '+' arr[i] arr i '+' a = operand.pop(-1) a operand.pop(-1) operand.pop operand pop -1 b = operand.pop(-1) b operand.pop(-1) operand.pop operand pop -1 operand.append(b + a) operand.append operand append b + a b a elif arr[i] == '-':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b - a)
     arr[i] == '-' arr[i] arr i '-' a = operand.pop(-1) a operand.pop(-1) operand.pop operand pop -1 b = operand.pop(-1) b operand.pop(-1) operand.pop operand pop -1 operand.append(b - a) operand.append operand append b - a b a elif arr[i] == '*':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b * a)
     arr[i] == '*' arr[i] arr i '*' a = operand.pop(-1) a operand.pop(-1) operand.pop operand pop -1 b = operand.pop(-1) b operand.pop(-1) operand.pop operand pop -1 operand.append(b * a) operand.append operand append b * a b a operand.append(int(arr[i])) operand.append operand append int(arr[i]) int arr[i] arr i i += 1 i 1 print(operand[0]) print operand[0] operand 0 b = operand.pop(-1) operand.pop(-1) b i = 0 0 i a = operand.pop(-1) operand.pop(-1) a a = operand.pop(-1) operand.pop(-1) a i += 1 1 i a = operand.pop(-1) operand.pop(-1) a operand = [] [] operand arr = list(map(str, input().split())) list(map(str, input().split())) arr b = operand.pop(-1) operand.pop(-1) b b = operand.pop(-1) operand.pop(-1) b
arr = list(map(str, input().split()))

i = 0

operand = []

while i < len(arr):
    if arr[i] == '+':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b + a)
    elif arr[i] == '-':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b - a)
    elif arr[i] == '*':
        a = operand.pop(-1)
        b = operand.pop(-1)
        operand.append(b * a)
    else:
        operand.append(int(arr[i]))
    i += 1

print(operand[0])

