You are given a directed graph g, and you must determine the number of distinct cycles in g that have length less than k. Since this number can be really big, return the answer modulo m. A cycle is a non-empty sequence of nodes (not necessarily distinct) in which there is an edge from each node to the next node, and an edge from the last node in the sequence to the first node. Two cycles are distinct if their sequences are not identical. See example 0 for further clarification.
g will be given as a String where the jth character of the ith element indicates whether there is an edge from node i to node j ('Y' means there is one, and 'N' means there is not).
|-||The answer modulo m means that you must return the remainder of dividing the result by m.|
|-||g will have between 1 and 35 elements, inclusive.|
|-||Each element of g will have exactly N characters, where N is the number of elements in g.|
|-||Each character of each element of g will be 'Y' or 'N'.|
|-||The ith character of the ith element of g will be 'N'.|
|-||k will be between 1 and 1000000 (106), inclusive.|
|-||m will be between 1 and 1000000000 (109), inclusive.|