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) { Scanner in = new Scanner(System.in); int[][] ar = new int[3][3]; int[] diff = new int[8]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ ar[i][j] = in.nextInt(); } } int mg1[][] = {{8,1,6},{3,5,7},{4,9,2}}; int mg2[][] = {{4,3,8},{9,5,1},{2,7,6}}; int mg3[][] = {{2,9,4},{7,5,3},{6,1,8}}; int mg4[][] = {{6,7,2},{1,5,9},{8,3,4}}; int mg5[][] = {{6,1,8},{7,5,3},{2,9,4}}; int mg6[][] = {{8,3,4},{1,5,9},{6,7,2}}; int mg7[][] = {{4,9,2},{3,5,7},{8,1,6}}; int mg8[][] = {{2,7,6},{9,5,1},{4,3,8}}; diff[0] = subtract(ar,mg1); diff[1] = subtract(ar,mg2); diff[2] = subtract(ar,mg3); diff[3] = subtract(ar,mg4); diff[4] = subtract(ar,mg5); diff[5] = subtract(ar,mg6); diff[6] = subtract(ar,mg7); diff[7] = subtract(ar,mg8); int min=diff[0]; for(int i=1;i<8;i++){ if(diff[i]