x = []
ans = 0
for i in range(4):
x.append(list(map(float, input().split())))
ans += x[i][i] + x[i][3-i]
print(ans)