codeforces; solve "Dreamoon and Sums" from Round #272 (Div. 2)