1.start = end = M (M == N//2)
2.for i in range(n): 을 반복하며 start~end 값을 누적한다
3.i < M 일때 start -= 1,end += 1
4.i >= M 일때 start += 1, end -= 1
T = int(input())
for t in range(1,T+1):
N = int(input())
arr = [list(map(int,input())) for _ in range(N)]
M = N // 2
answer = 0
for i in range(N):
if i <= M:
for j in range(M-i,M+i+1):
answer += arr[i][j]
else:
for x in range(i-M,(N-(i-M))):
answer += arr[i][x]
print(f'#{t} {answer}')