n = int(input())
b = []
s = 0
for i in range(n):
    l = list(map(int, input().split()))
    b.append(l)
for i in range(len(b)):
    s += b[i][i]
print(s)

86c3ef73384556e9f63992b6bf2a1755149968bf
<mask token>

<mask token>
for i in range(n):
    l = list(map(int, input().split()))
    b.append(l)
for i in range(len(b)):
    s += b[i][i]
print(s)

n = int(input())
b = []
s = 0
for i in range(n):
    l = list(map(int, input().split()))
    b.append(l)
for i in range(len(b)):
    s += b[i][i]
print(s)
