import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static int sumColumn(int[][] square, int columnNumber) { int sum = 0 ; for (int i = 0; i < square.length; i++) sum = sum + square[columnNumber][i] ; return sum ; } public static int sumRow(int[][] square, int rowNumber) { int sum = 0 ; for (int i = 0; i < square[0].length; i++) sum = sum + square[i][rowNumber] ; return sum ; } public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner reader = new Scanner(System.in); int n =0; int[][] matrix = new int[3][3];//automatically initialized with '0' int row = 0; // start with first row int col = n/2; //middle element int num = 1; // nu for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ matrix[i][j]=reader.nextInt(); } } /* for(int line=0 ; line < 3 ; line++){ for(int columna = 0; columna < 3 ; columna ++){ // System.out.printf("\t %d \t",matrix[line][columna]); } System.out.println(); } */ int isSame=0; int notSame=0; for(int i=0; i<3;i++){ if(sumRow(matrix,i)==15 && sumColumn(matrix,i)==15){ // System.out.println(sumRow(matrix,i)); // System.out.println(sumColumn(matrix,i)); }else{ notSame=sumRow(matrix,i); // System.out.println(notSame); } // System.out.println( (3*(3^2+1)/2)); } System.out.println((15-notSame)); } }