Konkotenacja

No attempts yetTime limit2sMemory limit128 MB

Problem

The konkotenacja of two words A and B is the word AkotB, that is, the two words joined by the literal string kot. For example, the konkotenacja of mas and ka is maskotka.

The operation extends to a whole sequence of words: konkotenate all of them in order, inserting kot between every pair of consecutive words. For example, konkotenating the sequence (aa, b, cc, d) yields aakotbkotcckotd.

Given a word W, how many different sequences of non-empty words produce W when konkotenated?

Input

The first line contains one integer Z (1Z101 \le Z \le 10), the number of test cases.

Each of the next Z lines contains one non-empty word W made up of lowercase English letters only. The length of W does not exceed 10000001\,000\,000.

Output

For each word, print on its own line one non-negative integer: the number of different sequences that produce that word when konkotenated, taken modulo 10000000071\,000\,000\,007.

Notes

The word maskotka can be produced by exactly two sequences: (mas, ka) and (maskotka).

The word akotkot can also be produced by exactly two sequences: (a, kot) and (akotkot).