Need help with this problem
How to solve this problem ?http://mirror.codeforces.com/contest/205/problem/B
Thanks.