A nonempty subset of grid cells is called "balanced" if the following conditions hold:
Count the number of balanced subsets modulo 109+7.
The first line contains N.The next N lines each contain a string of N characters. The j-th character of the i-th line from the top is equal to G if the cell at (i,j) contains grass, or . otherwise.
The number of balanced subsets modulo 109+7.
Test cases 1-4 satisfy N≤4Test cases 5-10 satisfy N≤20Test cases 11-20 satisfy no additional constraints.Problem credits: Benjamin Qi