We have created an infinite eight-directional crossword by taking a letter-filled block of dimensions
honi
hsin
then we create the following crossword:
...honihonihonihoni...
...hsinhsinhsinhsin...
...honihonihonihoni...
...hsinhsinhsinhsin...
that is infinite in all directions.
In the created crossword, we randomly choose a field and one of eight directions, then write down a word of length
Input Specification
The first line of input contains integers
Each of the following
Output Specification
You must output the required probability in the form of a reduced fraction
Scoring
In test cases worth
Sample Input 1
1 2 2
ab
Sample Output 1
5/16
Sample Input 2
2 4 3
honi
hsin
Sample Output 2
19/512
Sample Input 3
3 3 10
ban
ana
nab
Sample Output 3
2/27
Comments