import sys
sys.stdin = open('17136_색종이붙이기.txt', 'r')
def my_area(i, j, k):
    count = 0


    return count

def find():
    my_list = [5, 4, 3, 2, 1]
    for k in my_list:
        for i in range(10):
            for j in range(10):
                if arr[i][j] == 1:
                    a = my_area(i,j,k)


    return a


arr= [list(map(int, input().split())) for i in range(10)]
print(find())


