Solve SRM 564DIV2 250points 500points.