s = str(input()) S = [] temp = [] for c in s: if c != '*' and c!= '+': temp.append(c) else: S.append(''.join(temp)) S.append(c) temp = [] else: if temp: S.append(''.join(temp)) 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)