Runtime error for Codeforces 260B problem

Hi,
I am constantly getting Runtime Error for test-12 of this problem:
http://codeforces.com/problemset/problem/260/B
My submissions are as follows:
http://codeforces.com/contest/260/submission/17270090
http://codeforces.com/contest/260/submission/17269920

Can someone please point out which case I am missing?

Thanks