## Problem 1: Inspiration

It's time for a history test! Unfortunately, while some students have come well-prepared, others appear to have forgotten about the test entirely. They may need some "inspiration" to get through it with passing grades.

The desks in H.S. High School's history classroom are laid out in a nice, traditional grid. The grid has R (1 ≤ R ≤ 50,000) rows, numbered 1..R from front to back, and C (1 ≤ C ≤ 10) columns, numbered 1..C from left to right. The state of each desk in a given row r and column c is described by an integer Dr, c (0 ≤ Dr, c ≤ 2), which is one of the following:

• 0: That desk is unoccupied
• 1: That desk is occupied by a "type-1" student — one who has studied for the test
• 2: That desk is occupied by a "type-2" student — one who has not studied for the test

Each type-2 student is in trouble… unless they can catch a glimpse of inspiration, in the form of a type-1 student's test paper. Without looking too suspicious, a student can see manage to see the papers on some desks directly in front of them, in the same column. However, they can only clearly see at most the closest K (1 ≤ KR − 1) desks in front of them. In other words, the test paper of a type-1 student sitting in row r1 and column c1 can be seen by a type-2 student sitting in row r2 and column c2 if and only if c1 = c2 and r2Kr1r2 − 1. Note that a type-2 student doesn't gain any additional benefit from seeing multiple type-1 students' papers, and that it's possible for a single type-1 student's paper to inspire multiple type-2 students.

How many of the type-2 students can be inspired by looking at at least one type-1 student's test paper?

In test cases worth 4/13 of the points, K ≤ 10.
In test cases worth another 5/13 of the points, K = R − 1.

### Input Format

The first line of input consists of three space-separated integers, R, C, and K.
R lines follow, the i-th of which consists of integers, Di, 1..C, for i = 1..R.

### Output Format

Output a single integer, the number of type-2 students who can be inspired.

```5 3 2
1 0 1
1 2 2
0 1 2
2 1 2
0 2 2
```

```4
```

### Sample Explanation

The type-2 students in the 2nd and 3rd rows of the 3rd column can both be inspired by the type-1 student sitting at the front of that row.

The type-2 student in the 4th row of the 1st column can be inspired by the type-1 student sitting 2 desks in front of them.

Finally, the type-2 student at the back of the 2nd column can be inspired by either of the type-1 students sitting 1 or 2 desks in front of them.

Point Value: 7 (partial)
Time Limit: 4.00s
Memory Limit: 64M