powers of 1-5

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

Informace: powers of 1-5