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 scanner = new Scanner(System.in); int[][] arr = new int[3][3]; int row_diff= 0; int col_sum=0; int row=0; int col=0; int j=0; for(int i=0;i<3;i++) { int row_sum = 0; for(j=0;j<3;j++) { arr[i][j] = scanner.nextInt(); row_sum += arr[i][j]; // col_sum += arr[j][i]; } if(row_sum<15){ row = i; row_diff = row_sum; int diff = 15- row_diff; System.out.println(diff); return; } } } }