alupuri-treat

Anmol loves Alupuri and can do anything for it. His best friend Bhavesh tells him that he will give him Alupuri treat if he successfully solve a problem. So his friend Bhavesh gave him a square matrix of size M×M, and asked him to calculate the difference between the sums of its diagonals.Since Anmol is very weak in maths so he needs your help to solve this problem and get Alupuri treat.

Input Format:

The first line contains a single integer M. The next M lines denote the matrix's rows, with each line containing M space-separated integers describing the columns.

Output Format:

Print the absolute difference between the two sums of the matrix's diagonals as a single integer.

Constraints:

3 ≤ M ≤ 100

SAMPLE INPUT
3
9 2 10
8 3 6
7 6 -4

SAMPLE OUTPUT
12

Explanation

The primary diagonal is:
9
      3
            -4
Sum across the primary diagonal: 9 + 3 - 4 = 8

The secondary diagonal is:
            10
      3
7
Sum across the secondary diagonal: 10+ 3 + 7 = 20
Difference: |8-20 | = 12

Source: hackerearth | Difficulty: EASY


Solutions:
t=int(input())
su=int(0)
r=int(0)
for i in range(t):
	a=[]
	a=list(map(int,input().split()))
	su=su+a[i]
	r=r+a[t-i-1]
if su>=r:
	print(su-r)
else:
	print(r-su)


import math
len=int(input())
ans=0
for i in range(len):
	r=input()
	ans1=r.split(' ')
	ans=ans+int(ans1[i])-int(ans1[len-i-1])
print((int(math.fabs(ans))))


m = eval(input())
matrix = []
for i in range(m):
	row = list(map(int, input().split()))
	matrix.append(row)
dia1, dia2 = 0, 0    
for i in range(m):
	dia1 += matrix[i][i]
	dia2 += matrix[i][m - i - 1]
print(abs(dia1 - dia2))
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n=eval(input())
t=0
sp,ss=0,0
while t<n:
	l=[int(i) for i in input().split()]
	sp+=l[t]
	ss+=l[n-t-1]
	t+=1
print(abs(sp-ss))