a = []
for i in range(3):
a.append(list(map(int, input().split(
for i in a:
print(*i)
print(max(a[0]) + max(a[1]) + max(a[2]))
print(max(a[0]) * max(a[1]) * max(a[2]))
a = []
for i in range(3):
a.append(list(map(int, input().split(
for i in a:
print(*i)
print(max(a[0]) + max(a[1]) + max(a[2]))
print(max(a[0]) * max(a[1]) * max(a[2]))