s = str(input()) stack = [] for c in s: if not stack: stack.append(c) else: if c != '*' and c != '+': if stack[-1] != '*' and stack[-1] != '+': stack[-1] += c elif stack[-1] == '*': stack.pop() x = stack.pop() stack.append(str(int(x)+int(c))) else: stack.pop() x = stack.pop() stack.append(str(int(x)*int(c))) else: stack.append(c) print(*stack)