https://codeforces.com/contest/1316/submission/72509812