Calculate the sum of four adjacent integers in an NxN matrix, where N is input by the user.