l = [list(map(float, input().split())) for _ in range(5)]   
for i in range(5):
    for j in range(5):
        print('{:.1f} '.format(l[i][j]), end='')
    print('{:.1f}'.format(sum(l[i])))