Let aa and bb be positive integers. When a2+b2a^2 + b^2 is divided by a+ba + b, the quotient is qq and the remainder is rr. Find all pairs (a,b)(a, b) such that q2+r=1977q^2 + r = 1977.