https://codeforces.com/contest/1176/problem/F