## Square

### Cutting a square from a material

Jian-Jia has a piece of metal material and he wants to cut a square out of it. The material consists of n by n unit grids and Jian-Jia can only cut the material along grid boundary. Each grid is either usable or defective, and Jian-Jia wants to cut the largest possible square from the material without any defective grids. After determining the maximum size of the square, Jian-Jia also wants to know how many ways he can cut the largest square from this material. Finally Jian-Jia will report the product of the maximum size and the number of possible ways.

### Example

Consider the 6 by 6 material in the following figure. The black grids are defective. The largest square Jian-Jia can cut from the material is 3 by 3, and there are two ways to cut it – the red square and the green square. Jian-Jan will report the product of 3 and 2, which is 6.

Your task is to find the size of largest squares in the material, count the number of ways to cut them, and report the product of the size and the number.

### Input Format

• Line 1: the size of the material n;
• Line 2, …, n + 1:
• Each line has n integers. A 1 means the grid is useful and a 0 means the grid is defective.

### Output Format

You must output one integer – the product of the size of largest square in the material, and the number of possible locations in the material.

```6
1 0 1 0 1 0
0 1 0 1 0 1
1 0 1 0 1 0
0 1 0 1 0 1
1 0 1 0 1 0
0 1 0 1 0 1
```

```18
```

```6
0 1 1 1 1 0
1 0 1 1 1 1
0 1 1 1 1 1
1 1 0 1 1 1
1 1 1 1 0 1
1 1 0 1 1 1
```

```6
```

### Subtask 1 [10% of points]

• 1 ≤ n ≤ 100
• In any 2 by 2 material grids section there will be at least one defective grid.

• 1 ≤ n ≤ 500

### Subtask 3 [70% of points]

• 1 ≤ n ≤ 1000

Point Value: 12 (partial)
Time Limit: 2.00s
Memory Limit: 64M