SRM 533. div2-500. Submitted for 239 points