https://codeforces.com/contest/1408/submission/94357834