ji
where
S = Sx-1,y + Sx,y-1
+ Sx+1,y + Sx,y+1 + aSx,y