Getting runtime error-COINS

Can somebody please tell me why am I getting run-time error in COINS?
I think it is due to the the way this question takes the input?
If I am true can somebody please tell me how to take such type of inputs in java?
My code-http://www.codechef.com/viewsolution/4863429

//