the index pre [ li-1 ] [ bj ] and pre [ bi ] [ lj-1 ] will not exist as li=0 and lj=0;
and we know pre [ -1 ] [ bj ] and pre [ bj ] [ -1 ] does not exist.
for(int li=0 ; li < n ; li++ )
for(int lj=0;lj<n;lj++)
for(int bi=li;bi<n;bi++)
for(int bj=lj;bj<n;bj++)
{
sum+=a[bi][bj]-a[li-1][bj]-a[bi][lj-1]+a[li-1][lj-1];
}