https://codeforces.com/contest/1348/problem/B