https://codeforces.com/contest/1451/submission/99590346