#include<bits/stdc++.h>
using namespace std;

double a[45][45] = {};
double s[45] = {};

int main()
{
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            cin >> a[i][j];
            s[i] += a[i][j];
        }
    }
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            cout << fixed << setprecision(1) << a[i][j] << " "; 
        }
        cout << s[i] << endl; 
    }
    return 0;
}