https://codeforces.com/contest/1119/submission/52390780