Problem B of CodeForces Round #259 completed successfully.