Runtime error(NZEC) in byteland ques. (java program)

The following java program is showing runtime error(NZEC). Please help me to fix this.

 import java.util.*;
 class coins {
public static void main(String args[])
{
    int i=10;
    int n=0;
    Scanner in=new Scanner(System.in);
    while(i>0)
    {
    	
    	n=in.nextInt();
		System.out.println(calc(n));
		i--;
        
    }
    
}
static int calc(int x)
{
    if(((x%2)+(x%3)+(x%4))==0)
    {
        return (calc(x/2)+calc(x/3)+calc(x/4));
    }
    return x;
}

}

It is said that max test cases is 10. Any test case file might have less than that also. Dont preassume. So you should check if there is any other number to calculate by checking if you have reached the end of file or not. Remove the variable ā€˜iā€™ and in while loop it should be the condition to check for end of file. For java i guess it is scanner.hasNext() function.