시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 256 MB168562.500%

문제

We have created an infinite eight-directional crossword by taking a letter-filled block of dimensions M x N and infinitely repeating it. For instance, if we are given the following block:

honi
hsin

then we create the following crossword:

...honihonihonihoni...
...hsinhsinhsinhsin...
...honihonihonihoni...
...hsinhsinhsinhsin...

that is inifinite in all directions.

In the created crossword, we randomly choose a field and one of eight directions, then write down a word of length K obtained by reading the crossword starting from the initial field, in the chosen direction. If we executed this query twice (independently), we would obtain two words of length K. Calculate the probability that the two words are equal. 

입력

The first line of input contains integers M, N, K from the task (1 ≤ M, N ≤ 500, 2 ≤ K ≤ 109 ).

Each of the following M lines contains N lowercase letters of the English alphabet, and describes a block of the crossword. At least two distinct letters will exist in the block. 

출력

You must output the required probability in the form of a reduced fraction p/q, without spaces. 

예제 입력 1

1 2 2
ab

예제 출력 1

5/16

예제 입력 2

2 4 3
honi
hsin

예제 출력 2

19/512

예제 입력 3

3 3 10
ban
ana
nab

예제 출력 3

2/27