n=int(input()) l=input().split() for i in range(n): if l[i] in {'+','-','*','/'}: l[i-2:i+1]=['','',l[i-2]+l[i]+l[i-1]] print(eval(''.join(l)))