For this Question: You are given a chessboard of size N x N, where the top left square is black. Each square contains a value. Find the sum of the values of all black squares and all white squares.

Remember that in a chessboard black and white squares are alternate.The first line of input will be the N size of the matrix. Then next N lines will consist of elements of the matrix. Each row will contain N elements since it is a square matrix.

<b>Constraints:-</b>
1 &le; N &le; 800
1 &le; Matrix[i][j] &le; 100000
Print two lines, the first line containing the sum of black squares and the second line containing the sum of white squares.Input 1:
3
1 2 3
4 5 6
7 8 9

Output 1:
25
20

Sample Input 2:
4
1 2 3 4
6 8 9 10
11 12 13 14
15 16 17 18

Sample Output 2:
80
79

<b>Explanation 1</b>
The black square contains 1, 3, 5, 7, 9; sum = 25
The white square contains 2, 4, 6, 8; sum = 20, I have written this Solution Code: import java.util.*;
import java.io.*;
import java.lang.*;

class Main
{
    public static void main (String[] args)throws IOException {
Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        
        int mat[][] = new int[N][N];
        
        for(int i = 0; i < N; i++)
        {
            for(int j = 0; j < N; j++)
                mat[i][j] = sc.nextInt();
            
        }
        alternate_Matrix_Sum(mat,N);
        
         }

  

  static void alternate_Matrix_Sum(int mat[][], int N)
    {
        long sum =0, sum1 = 0;
        for(int i = 0; i < N; i++)
        {
            for(int j = 0; j < N; j++)
            {
                if((i+j)%2 == 0)
                  sum += mat[i][j];
                else sum1 += mat[i][j];
            }
            
        }
        System.out.println(sum);
        System.out.print(sum1);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?