import java.util.Scanner; import java.lang.Thread; class Adder extends Thread { private int [] row; private Integer subtotal; public Adder( int [] row, Integer subtotal ) { this.row = row; this.subtotal = subtotal; } // Adder public void run() { for ( int r = 0; r < row.length; r += 1 ) { subtotal += row[r]; System.out.println( subtotal + " " ); } // for } // run } // Adder public class Driver { public static void main( String [] args ) { Scanner in = new Scanner( System.in ); int rows, cols; rows = in.nextInt(); cols = in.nextInt(); int matrix[][] = new int[rows][cols]; Integer subtotals[] = new Integer[rows]; int total = 0, r, c; System.out.println( rows + " " + cols ); for ( r = 0; r < rows; r += 1 ) { for ( c = 0; c < cols; c += 1 ) { matrix[r][c] = in.nextInt(); System.out.print( matrix[r][c] + " " ); } // for System.out.println(); } // for Adder adders[] = new Adder[rows]; for ( r = 0; r < rows; r += 1 ) { subtotals[r] = new Integer( 0 ); adders[r] = new Adder( matrix[r], subtotals[r] ); adders[r].start(); } // for for ( r = 0; r < rows; r += 1 ) { try { adders[r].join(); } catch( InterruptedException e ) { } // try total += subtotals[r]; System.out.println( "X" + subtotals[r] ); } // for System.out.println( total ); } // main } // Driver