public class SingleThreadedAverage {
    public static double calculate(int[][] matrix) {
        long sum = 0;
        int count = 0;
        int size = matrix.length;

        for (int i = 0; i < size; i++) {
            for (int j = 0; j < i; j++) {
                sum += matrix[i][j];
                count++;
            }
        }

        return (double) sum / count;
    }