Runtime Error : NZEC
===

I keep getting a runtime error on my submission to the problem at http://www.codechef.com/problems/LASTDIG.

My code is as follows : 

    
    import java.util.Scanner;


    public class Main {
	public static void main(String[] args) {
		try
		{
		Scanner in = new Scanner(System.in);
		int i,j;
		System.out.println("Enter the no. of test cases - ");
		int cases = in.nextInt();
	
		int[][] a = new int[cases][2];
		int[] lds = new int[cases];	
		for(i=0; i<cases; i++)
		{
			for(j=0; j<2; j++)
			{
				a[i][j]=in.nextInt();
			}
		}

		for(j=0; j<cases; j++)
		{
		lds[j] = 0;
		int LENGTH = a[j][1] - a[j][0] +1;
		int[] arr = new int[LENGTH];
		//System.out.printf("%d\n",LENGTH);
		int[]sum = new int[LENGTH];
		
		for(i=0; i<LENGTH; i++){
			sum[i] = 0;
			arr[i] = a[j][0] + i;
		}
		
		for(i=0; i<LENGTH; i++)
		{
		int temp = arr[i];
		while(temp !=0 ){
			int r = temp%10;
			temp /= 10;
			if(r%2 == 0)
				sum[i] += r*2;
			else
				sum[i] += r;
			}
		}
		
		for(i=0; i<LENGTH; i++){
			lds[j] += sum[i]%10;
		}

		}
		
	for(i=0; i<cases; i++)
	{
		System.out.printf("%d\n",lds[i]);
		}
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}
	
	}
}

Please help me out over here, considering the problem is an easy one.

Thanks !