The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Codeforces Round 154 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

brute force

two pointers

*2000

No tag edit access

The problem statement has recently been changed. View the changes.

×
D. Table with Letters - 2

time limit per test

2 secondsmemory limit per test

256 megabytesinput

input.txtoutput

output.txtVasya has recently started to learn English. Now he needs to remember how to write English letters. He isn't sure about some of them, so he decided to train a little.

He found a sheet of squared paper and began writing arbitrary English letters there. In the end Vasya wrote *n* lines containing *m* characters each. Thus, he got a rectangular *n* × *m* table, each cell of the table contained some English letter. Let's number the table rows from top to bottom with integers from 1 to *n*, and columns — from left to right with integers from 1 to *m*.

After that Vasya looked at the resulting rectangular table and wondered, how many subtables are there, that matches both following conditions:

- the subtable contains at most
*k*cells with "a" letter; - all letters, located in all four corner cells of the subtable, are equal.

Formally, a subtable's definition is as follows. It is defined by four integers *x*_{1}, *y*_{1}, *x*_{2}, *y*_{2} such that 1 ≤ *x*_{1} < *x*_{2} ≤ *n*, 1 ≤ *y*_{1} < *y*_{2} ≤ *m*. Then the subtable contains all such cells (*x*, *y*) (*x* is the row number, *y* is the column number), for which the following inequality holds *x*_{1} ≤ *x* ≤ *x*_{2}, *y*_{1} ≤ *y* ≤ *y*_{2}. The corner cells of the table are cells (*x*_{1}, *y*_{1}), (*x*_{1}, *y*_{2}), (*x*_{2}, *y*_{1}), (*x*_{2}, *y*_{2}).

Vasya is already too tired after he's been writing letters to a piece of paper. That's why he asks you to count the value he is interested in.

Input

The first line contains three integers *n*, *m*, *k* (2 ≤ *n*, *m* ≤ 400; 0 ≤ *k* ≤ *n*·*m*).

Next *n* lines contain *m* characters each — the given table. Each character of the table is a lowercase English letter.

Output

Print a single integer — the number of required subtables.

Examples

Input

3 4 4

aabb

baab

baab

Output

2

Input

4 5 1

ababa

ccaca

ccacb

cbabc

Output

1

Note

There are two suitable subtables in the first sample: the first one's upper left corner is cell (2, 2) and lower right corner is cell (3, 3), the second one's upper left corner is cell (2, 1) and lower right corner is cell (3, 4).

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/18/2024 13:05:55 (l2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|