Help needed

https://codeforces.com/contest/1020/problem/A