题目描述
Problem Description
There are $N$ numbers arranged in a row (representing heights). Initially, all numbers are zero. You can choose a continuous segment of numbers of the same height and increase them all by 1 (except for the first and last number in the segment). The following diagram illustrates two operations:

Now, some numbers are unclear and are represented by $-1$. You need to determine how many possible solutions exist such that the visible numbers exactly match the described operation method.
Input Format
The first line contains a positive integer $N$, representing the number of numbers.
The next line contains $N$ numbers, each representing the height of a number. $-1$ indicates an unclear number, which can be replaced by any number that satisfies the conditions. The $i$-th number is denoted by $h_i$.
Output Format
A single number representing the total number of possible solutions modulo $1000000007$.
Sample Input and Output
Sample Input #1
3
-1 2 -1
Sample Output #1
0
Sample Input #2
3
-1 -1 -1
Sample Output #2
2
Sample Input #3
6
-1 -1 -1 2 -1 -1
Sample Output #3
3
Notes
- $1 \leq N \leq 10000$
- $-1 \leq h_i \leq 10000$
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分