public byte[][] AAcalculate(byte[][] A, int K, int[] ESIs, int[] d, int[] a, int[] b, int Lp)
	{
		
		int L=A[1].length; //for column size. if we need row size just Aarg.length is enough
		int N=ESIs.length;
		
		
		byte [][] GLTnew= new byte[N][L];
		byte [][] Anew= new byte[(L-K)+N][L];
		
		
		int tem=0;

		for (int jj=0; jj<N; jj++)
		{
			tem=b[ESIs[jj]];
			while (tem>=L)
				tem=((tem+a[ESIs[jj]]) % Lp);

			GLTnew[jj][tem]= 1;

			int SS=Math.min(d[ESIs[jj]]-1, L-1);

			for (int i=0; i<SS; i++)
			{
				tem=((tem+a[ESIs[jj]]) % Lp);
				while (tem>=L)
					tem=((tem+a[ESIs[jj]]) % Lp);

				GLTnew[jj][tem]= 1;
			}

		}
		
		int pp=-1;
		for (int i=0; i<(L-K)+N ; i++)
		{
			if (i>=L-K)
				pp++;
		
			for (int j=0; j<L; j++)
			{
				
				if (i<L-K)
					Anew[i][j]=A[i][j];
				
				if (i>=L-K)
					Anew[i][j] =GLTnew[pp][j];
								
			}
		}
		
		return Anew;
		
		
	}