Hi, I'm trying to solve this problem in Ruby: http://codeforces.net/contest/580/problem/C but I got RUNTIME ERROR on test number 35: http://codeforces.net/contest/580/submission/25929179
Here is my code: http://ideone.com/B0XtIg
Thank you in advance for your help