#!/bin/python3

import sys
arr = []
def max(a,b):
    return a if a>b else b
def sum(i,j):
    return arr[i][j]+arr[i][j+1]+arr[i][j+2]+arr[i+1][j+1]+arr[i+2][j]+arr[i+2][j+1]+arr[i+2][j+2]
ans = -100
for arr_i in range(6):
   arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
   arr.append(arr_t)
for i in range(4):
    for j in range(4):
        ans = max(ans,sum(i,j))
print(ans)

940c1245f768af94425f1b0e65d0d42607b8784f
<mask token>


def max(a, b):
    return a if a > b else b


<mask token>

<mask token>


def max(a, b):
    return a if a > b else b


def sum(i, j):
    return arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + arr[i + 1][j + 1] + arr[
        i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2]


<mask token>
for arr_i in range(6):
    arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
    arr.append(arr_t)
for i in range(4):
    for j in range(4):
        ans = max(ans, sum(i, j))
print(ans)

<mask token>
arr = []


def max(a, b):
    return a if a > b else b


def sum(i, j):
    return arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + arr[i + 1][j + 1] + arr[
        i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2]


ans = -100
for arr_i in range(6):
    arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
    arr.append(arr_t)
for i in range(4):
    for j in range(4):
        ans = max(ans, sum(i, j))
print(ans)

import sys
arr = []


def max(a, b):
    return a if a > b else b


def sum(i, j):
    return arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + arr[i + 1][j + 1] + arr[
        i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2]


ans = -100
for arr_i in range(6):
    arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
    arr.append(arr_t)
for i in range(4):
    for j in range(4):
        ans = max(ans, sum(i, j))
print(ans)

#!/bin/python3

import sys
arr = []
def max(a,b):
    return a if a>b else b
def sum(i,j):
    return arr[i][j]+arr[i][j+1]+arr[i][j+2]+arr[i+1][j+1]+arr[i+2][j]+arr[i+2][j+1]+arr[i+2][j+2]
ans = -100
for arr_i in range(6):
   arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
   arr.append(arr_t)
for i in range(4):
    for j in range(4):
        ans = max(ans,sum(i,j))
print(ans)
