import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { 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 scan = new Scanner(System.in); int[][] matrix = new int[3][3]; int test; for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ matrix[i][j] = scan.nextInt(); } } int sumA = matrix[0][0] + matrix[0][1] + matrix[0][2]; int sumB = matrix[1][0] + matrix[1][1] + matrix[1][2]; int sumC = matrix[2][0] + matrix[2][1] + matrix[2][2]; int sumD = matrix[0][0] + matrix[1][0] + matrix[2][0]; int sumE = matrix[0][1] + matrix[1][1] + matrix[2][1]; int sumF = matrix[0][2] + matrix[1][2] + matrix[2][2]; int sumG = matrix[0][0] + matrix[1][1] + matrix[2][2]; int sumH = matrix[0][2] + matrix[1][1] + matrix[2][0]; if(sumA == sumB){ if(sumD == sumE){ if(sumD>sumF) test = 1; else test = -1; matrix[2][2] = matrix[2][2] + sumD - (sumF * test); System.out.println(sumD - (sumF * test)); } if(sumD == sumF){ if(sumD>sumE) test = 1; else test = -1; matrix[2][1] = matrix[2][1] + sumD - (sumE * test); System.out.println(sumD - (sumE * test)); } if(sumE == sumF){ if(sumE>sumF) test = 1; else test = -1; matrix[2][0] = matrix[2][0] + sumE - (sumF * test); System.out.println(sumE - (sumF * test)); } } if(sumA == sumC){ if(sumD == sumE){ if(sumD>sumF) test = 1; else test = -1; matrix[1][2] = matrix[1][2] + sumD - (sumF * test); System.out.println(sumD - (sumF * test)); } if(sumD == sumF){ if(sumD>sumE) test = 1; else test = -1; matrix[1][1] = matrix[1][1] + sumD - (sumE * test); System.out.println(sumD - (sumE * test)); } if(sumE == sumF){ if(sumE>sumF) test = 1; else test = -1; matrix[1][0] = matrix[1][0] + sumE - (sumF * test); System.out.println(sumE - (sumF * test)); } } if(sumB == sumC){ if(sumD == sumE){ if(sumD>sumF) test = 1; else test = -1; matrix[0][2] = matrix[0][2] + sumD - (sumF * test); System.out.println(sumD - (sumF * test)); } if(sumD == sumF){ if(sumD>sumE) test = 1; else test = -1; matrix[0][1] = matrix[0][1] + sumD - (sumE * test); System.out.println(sumD - (sumE * test)); } if(sumE == sumF){ if(sumE>sumF) test = 1; else test = -1; matrix[0][0] = matrix[0][0] + sumE - (sumF * test); System.out.println(sumE - (sumF * test)); } } } }