You are given a N x N matrix and have to perform Q queries on it. Queries are of 2 types:
a) 1 a b c : For each element eij (a<=i<=b and 1<=j<=N) in the matrix, eij=eij⊕c
b) 2 a b c : For each element eij (1<=i<=N and a<=j<=b) in the matrix, eij=eij⊕c
After these queries are performed, print the sum of the diagonal (top left to bottom right) elements.
INPUT
The first line contains an integer denoting N
The next N lines contains N space separated integers
The next line contains an integer denoting Q
The next Q lines contain 4 space separated integers depending on the type of query
OUTPUT
A single line denoting the sum of diagonal elements of the final matrix
CONSTRAINTS
1<=N<=1000
1<=Q<=2∗106
1<=c<=103
1<=a,b<=N
1<=eij<=104
NOTE: Use fast I/O.