시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 349 | 111 | 94 | 31.864% |
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.
Output a single line containing the number of bacteria that remains after doing all the experiments, or “error”.
3 0 0 0
8
5 1 1 1 1 1
1
5 0 2 2 4 0
0
5 0 2 2 4 1
error