Solve for n d=2m+5n