import java.util.Scanner;
public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        double[][] array = new double[5][5];
        double[] sum = new double[5];
        for(int i = 0 ; i < 5 ; i++){
            for(int j = 0 ; j < 5 ; j++){
                array[i][j] = sc.nextDouble();
                sum[i] += array[i][j];
            }
        }
        for(int i = 0 ; i < 5 ; i++){
            for(int j = 0 ; j < 5 ; j++){
                System.out.print(String.format("%.1f", array[i][j]) + " " );
            }
            System.out.println(String.format("%.1f", sum[i]));
        }
    }
}