CodeForces 268 div 2, A and B. AC.