Free Parentheses

You are given a simple arithmetic expression which consists of only addition and subtraction operators. For example: 1-2+3-4-5 You are free to put any parentheses to the expression anywhere you want and as many as you want. However it should be a valid expression after you put the parentheses. The question is how many different numbers can you make? For example, adding parentheses to the above expression can give you 6 different values: 1-2+3-4-5 1 - (2 + 3 - 4 - 5) 1 - (2 + 3) - 4 - 5 1 - 2 + 3 - (4 - 5) 1-(2+3-4)-5} 1-(2+3)-(4-5)= -3 Input There will be many expressions in the input. Each expression is written in one line. The expression con- sists of only N (2 ≤ N ≤ 30) non-negative number less than 100, separated by addition or subtraction operators. There will be no operator before the first number. Output For each expression, print the number of different values that can be derived from the expression by adding any number of parentheses. Sample Input 1-2+3-4-5 38 + 29 - 91 54 - 18 + 22 + 74 Sample Output 6 1 3 = -7 = 5 = -13 = 3 = -5