S = input() n = len(S) Stacks = [[], []] OP = [] depth = 0 for i in range(n): if '0' <= S[i] <= '9': Stacks[depth].append(int(S[i])) elif S[i] == '(': depth += 1 elif S[i] == ')': a = Stacks[depth].pop() depth -= 1 Stacks[depth].append(a) else: OP.append(S[i]) if len(Stacks[depth]) == 2: a = Stacks[depth].pop() b = Stacks[depth].pop() op = OP.pop() if op == '+': b += a elif op == '-': b -= a Stacks[depth].append(b) print(Stacks[0][0])