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