시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB215655428.272%

문제

A scientist, E. Collie, is going to do some experiments with bacteria. Right now, she has one bacterium. She already knows that this species of bacteria doubles itself every hour. Hence, after one hour there will be 2 bacteria. E.

E. Collie will do one experiment every hour, for n consecutive hours. She starts the first experiment exactly one hour after the first bacterium starts growing. In experiment i she will need bi bacteria.

How many bacteria will be left directly after starting the last experiment? If at any point there are not enough bacteria to do the experiment, print “error”.

Since the answer may be very large, please print it modulo 109 + 7.

입력

The input consists of two lines.

• The first line contains an integer 1 ≤ n ≤ 105, the number of experiments.
• The second line contains n integers b1, . . . , bn, where 0 ≤ bi ≤ 260 is the number of bacteria used in the ith experiment.

출력

Output a single line containing the number of bacteria that remains after doing all the experiments, or “error”.

예제 입력 1

3
0 0 0


예제 출력 1

8


예제 입력 2

5
1 1 1 1 1


예제 출력 2

1


예제 입력 3

5
0 2 2 4 0


예제 출력 3

0


예제 입력 4

5
0 2 2 4 1


예제 출력 4

error