'''
#!2D arrays
number_grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [0]]
#!This grid has 4 rows and 3 columns

1,2,3
4,5,6
0

print(number_grid[0][0])
# Print row
for row in number_grid:
    for column in row:
        print(column)

'''

#!/bin/python3

import math
import os
import random
import re
import sys


if __name__ == '__main__':
    arr = []

    for _ in range(6):
        arr.append(list(map(int, input().rstrip().split())))

    def total()
    minimum = -9 * 7
    current = 0
    for row in range(1, 5):
        for column in range(1, 5):
            current =
