powers of 1-5

How can you tell the total number of squares for different values of m and n?

Information: powers of 1-5