a,b,c,d,e = int(input())
f,g,h,i,j = int(input())
k,l,m,n,o = int(input())
p,q,r,s,t = int(input())
u,v,w,x,y = int(input())
for i in range(5):
    for j in range(5):
        if I == 1:
            l = 0
print(l)        