1520d codeforces solution