Training Site

# Mental A

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 64 megabytes
Time limit: 1.0 seconds

Mrs Sanchez is a teacher who wants to be sure that her students can do mental arithmetic. She devises a way to test them.

She will firstly tell them how many numbers are coming ($N$), and there will be at least 2.

They must then add, then subtract and then multiply previous answers by the next number in turn. Once they have multiplied, the next number should be added, etc.

For example, if Mrs Sanchez says there are $N = 7$ numbers and they are: $4$, $5$, $7$, $2$, $9$, $1$, $10$, then the process is:

• $4 + 5 = 9$
• $9 - 7 = 2$
• $2 \times 2 = 4$
• $4 + 9 = 13$
• $13 - 1 = 12$
• $12 \times 10 = 120$

Your job is to tell her what the final answer should be.

## Input

The first line will contain a single integer, $N$ ($2 \le N \le 20$).

The following $N$ lines will each contain a single integer $x_i$ ($1 \le x_i \le 10$), in the order announced by Mrs Sanchez.

## Output

You should print a single integer – the final answer to Mrs Sanchez's test.

• Subtask 1 (40%): $N = 4$
• Subtask 2 (60%): $2 \le N \le 20$
• ### Sample Input 1

4
4
5
7
2


### Sample Output 1

4

• ### Sample Input 2

7
4
5
7
2
9
1
10


### Sample Output 2

120