2005 AIME I Problem 4

The director of a marching band wishes to place the members into a formation that includes all of them and has no unfilled positions. If they are arranged in a square formation, there are 5 members left over. The director finds that if they are arranged in a rectangular formation with 7 more rows than columns, the desired result can be obtained. Find the maximum number of members this band can have.