import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] arr = sc.next().toCharArray(); ArrayDeque numStack = new ArrayDeque<>(); ArrayDeque boolStack = new ArrayDeque<>(); numStack.push(0); boolStack.push(true); int num = 0; int tmp = 0; boolean isPlus = true; for (char c : arr) { if (c == '+' || c == '-') { if (isPlus) { num += tmp; } else { num -= tmp; } tmp = 0; isPlus = (c == '+'); } else if (c == '(') { if (isPlus) { num += tmp; } else { num -= tmp; } numStack.push(num); boolStack.push(isPlus); num = 0; tmp = 0; isPlus = true; } else if (c == ')') { if (isPlus) { num += tmp; } else { num -= tmp; } isPlus = boolStack.pop(); if (isPlus) { num = numStack.pop() + num; } else { num = numStack.pop() - num; } tmp = 0; isPlus = true; } else { tmp *= 10; tmp += c - '0'; } } if (isPlus) { num += tmp; } else { num -= tmp; } System.out.println(num); } }