lst = raw_input().split()
lst2 = []
for v in lst:
    if v == "+":
        lst2[len(lst2)-2] += lst2.pop()
    elif v == "-":
        lst2[len(lst2)-2] -= lst2.pop()
    elif v == "*":
        lst2[len(lst2)-2] *= lst2.pop()
    elif v == "/":
        lst2[len(lst2)-2] /= lst2.pop()
    else:
        lst2.append(int(v))
print lst2[0] lst = raw_input().split() lst raw_input().split() ().split () raw_input split lst2 = [] lst2 [] for v in lst:
    if v == "+":
        lst2[len(lst2)-2] += lst2.pop()
    elif v == "-":
        lst2[len(lst2)-2] -= lst2.pop()
    elif v == "*":
        lst2[len(lst2)-2] *= lst2.pop()
    elif v == "/":
        lst2[len(lst2)-2] /= lst2.pop()
    else:
        lst2.append(int(v)) v lst if v == "+":
        lst2[len(lst2)-2] += lst2.pop()
    elif v == "-":
        lst2[len(lst2)-2] -= lst2.pop()
    elif v == "*":
        lst2[len(lst2)-2] *= lst2.pop()
    elif v == "/":
        lst2[len(lst2)-2] /= lst2.pop()
    else:
        lst2.append(int(v)) v == "+" v "+" lst2[len(lst2)-2] += lst2.pop() lst2[len(lst2)-2] lst2 len(lst2)-2 len(lst2) len lst2 2 lst2.pop() lst2.pop lst2 pop elif v == "-":
        lst2[len(lst2)-2] -= lst2.pop()
     v == "-" v "-" lst2[len(lst2)-2] -= lst2.pop() lst2[len(lst2)-2] lst2 len(lst2)-2 len(lst2) len lst2 2 lst2.pop() lst2.pop lst2 pop elif v == "*":
        lst2[len(lst2)-2] *= lst2.pop()
     v == "*" v "*" lst2[len(lst2)-2] *= lst2.pop() lst2[len(lst2)-2] lst2 len(lst2)-2 len(lst2) len lst2 2 lst2.pop() lst2.pop lst2 pop elif v == "/":
        lst2[len(lst2)-2] /= lst2.pop()
     v == "/" v "/" lst2[len(lst2)-2] /= lst2.pop() lst2[len(lst2)-2] lst2 len(lst2)-2 len(lst2) len lst2 2 lst2.pop() lst2.pop lst2 pop lst2.append(int(v)) lst2.append lst2 append int(v) int v print lst2[0] lst2 0 lst = raw_input().split() raw_input().split() lst lst2 = [] [] lst2
lst = raw_input().split()
lst2 = []
for v in lst:
    if v == "+":
        lst2[len(lst2)-2] += lst2.pop()
    elif v == "-":
        lst2[len(lst2)-2] -= lst2.pop()
    elif v == "*":
        lst2[len(lst2)-2] *= lst2.pop()
    elif v == "/":
        lst2[len(lst2)-2] /= lst2.pop()
    else:
        lst2.append(int(v))
print lst2[0]