Wrong answer on test 4: http://codeforces.com/contest/387/submission/5928430