m1 = list(map(float, input().split()))
m2 = list(map(float, input().split()))
m3 = list(map(float, input().split()))
m4 = list(map(float, input().split()))
m5 = list(map(float, input().split()))
m1.append(sum(m1))
m2.append(sum(m2))
m3.append(sum(m3))
m4.append(sum(m4))
m5.append(sum(m5))
print(*m1)
print(*m2)
print(*m3)
print(*m4)
print(*m5)