Codeforces Beta Round 265 div 2, A and B. AC.