Minsik has an N x M rectangular table filled with uppercase letters. He copies the table once horizontally and once vertically, making a larger 2N x 2M table made from four copies of the original. Then he considers every subrectangle of this larger table.
Consider the following 1 x 2 table.
After copying it into a 2 x 2 arrangement of copies, the larger table is:
This table has 30 subrectangles. They are shown below, where . is used only as a separator.
Find, over all subrectangles of the larger table, how many times each uppercase letter appears in total. In the case above, K appears 40 times and O appears 40 times.