Your task is to construct a building. There are N people in your city and the ith person contains a string codeword Si. Each of them randomly selects a non-empty substring of his codeword and calls this substring Flag. The building is constructed only if all their Flag 's are palindrome and pairwise identical.
You are not sure whether the building will get constructed. Your task is to calculate the probability that the building is constructed so that you can prepare for the next construction. It can be shown that this probability can be expressed as a fraction PQ, where P and Q are coprime integers, P≥0, Q>0 and Q is coprime with 109+7. You should compute (P∗Q−1)mod(109+7), where Q−1 denotes the multiplicative inverse of Q modulo 109+7.
Input format
Output format
Print a single integer denoting the answer to the problem.
Constraints
1≤N≤105
1≤|Si|≤106
∑ i=N i=1|Si|≤106
All codewords consist of only lowercase Latin letters
We consider possible candidate palindromes one by one :
Total number of ways to choose identical palindrome Flag=6
Total number of ways to choose Flag=3∗(3+1)2∗3∗(3+1)2=36
So Probability to choose identical palindrome Flag = 636