Solve for q a=qb+r