https://codeforces.com/contest/1388/submission/88495079