#d2126. 路径计数

路径计数

Path Counting

Problem Description

There is an n×nn \times n grid; some cells are passable and some are obstacles.

You start at the top-left corner and may move down or right one step at a time each move. Count the number of ways to reach the bottom-right corner.

Since the answer may be large, output it modulo 109+710^9+7.

Input Format

The first line contains a positive integer nn.

The following nn lines each contain nn positive integers; 11 means passable and 00 means blocked.

Output Format

One integer: the answer.

Sample Input

3
1 1 1
1 0 1
1 1 1

Sample Output

2

Constraints

For 100%100\% of the data, 2≤n≤1002\le n\le 100, and both the top-left and bottom-right corners are passable.