Solve SRM 554DIV1 250 points