Solve srm601 500 WinterAndCandies.