Олимпиадный тренинг

Задача 38377. Flag


Innokenty works at a flea market, selling all sorts of rubbish and unusual things to visitors. Recently, he found an old rectangular bedspread in his warehouse. As it turned out, this blanket has a mesh shape, that is, the blanket consists of nm colored patches, divided into n rows and m columns.

The colored shreds attracted the attention of Innokenty, and he immediately figured out how to make money on his find. If you cut out a sub-rectangle from the bedspread, consisting of three colored stripes, then this sub-rectangle can then be sold as the flag of some country. In particular, Innokenty believes that the subrectangle will be sufficiently similar to the flag of some country if it consists of three same-color stripes of the same height, located one under the other. Of course, the color of the upper strip must not match the color of the middle strip, and the color of the middle must not match the color of the bottom.

Innokenty does not yet know from which part of the bedspread he will cut the flag, but he definitely decided that he would cut the flag only along the lines of the grid, while the bedspread should in no case be rotated. Help Innokenty and count the number of different sub-rectangles that can be cut out of the bedspread and sold as a flag. Subrectangles that form the same flags, but the covers located in different places, are considered different.



Input
The first line contains two integers n and m (1 ≤ n, m ≤ 1000 ) — the number of rows and columns in the bedspread.

Each of the next n lines describes the next line of the veil and consists of m lowercase Latin letters from « a " to « z », where the same colors correspond to the same letters, and different colors — different letters.

Imprint
In a single line print a single integer — the number of subrectangles that are flags.

Note
Examples
# Input Output
1 4 3
aaa
bbb
ccb
ddd
6