Palindromic Paths#7826

Palindromic Paths

1 second
64 megabytes
Hard

Given a square table of size n \times n filled with natural numbers, we are interested in finding paths from the top-left corner to the bottom-right corner. These paths can only move right or down, never left or up. Each path will consist of 2n - 1 numbers. If the sequence of numbers along a path reads the same forwards and backwards, we call it a palindromic path.

Task

Your task is to calculate the total number of palindromic paths in the given table.

Input

The input begins with a single integer (2 \le n \le 100), representing the size of the table. This is followed by lines, each containing natural numbers, none exceeding , which populate the table.

Output

Output a single number: the remainder when the total number of palindromic paths is divided by .

Examples

3
7 10 7
5 8 10
8 5 7
4
5
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
50

Example 1

Loading
Loading

Example 2

Loading
Loading

Note

In the first example, there are four palindromic paths:

right — right — down — down (7-10-5-10-7);

right — down — right — down (7-10-8-10-7);

down — right — down — right (7-5-8-5-7);

down — down — right — right (7-5-8-5-7).

In the second example, all possible paths are palindromic. Therefore, the output should be the remainder of divided by , which is .