http://codeforces.com/contest/733/submission/21966734