We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- All Contests
- ProjectEuler+
- Project Euler #166: Criss Cross

# Project Euler #166: Criss Cross

# Project Euler #166: Criss Cross

_{This problem is a programming version of Problem 166 from projecteuler.net}

A grid is filled with digits .

It can be seen that in the grid

```
6 3 3 0
5 0 4 3
0 7 1 4
1 2 4 5
```

the sum of each row and each column has the value . Moreover the sum of each diagonal is also .

In how many ways can you fill a grid with the digits so that each row, each column, and both diagonals have the same sum?

**Input Format**

One integer is given on first line representing

**Constraints**

**Output Format**

Print one integer which is the answer to the problem.

**Sample Input 0**

```
1
```

**Sample Output 0**

```
34
```