problem D - Codeforces round 225 div 2