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