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 in = new Scanner(System.in); int[][] a=new int[3][3]; int ini=-1,inj=-1; int small; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ a[i][j]=in.nextInt(); /* if(a[i][j]==1 && Math.abs(i-j)==1){ ini=i; inj=j; }*/ } } /* int cost=0; if(ini==-1 || inj==-1){ //'1' no present in array small=a[0][1]; ini=0;inj=1; if(small>a[1][0]){ small=a[1][0]; ini=1; inj=0; } if(small>a[1][2]){ small=a[1][2]; ini=1; inj=2; } if(small>a[2][1]){ small=a[2][1]; ini=2; inj=1; } cost=cost+a[ini][inj]-1; a[ini][inj]=1; } int x1[]={2,7,6,9,5,1,4,3,8}; int x2[]={4,9,2,3,5,7,8,1,6}; int x3[]={6,1,8,7,5,3,2,9,4}; int x4[]={8,3,4,1,5,6,6,7,2}; int[] x= new int[9]; // cout<