Codeforces round 354, finish task B