O(n³) Stress Test Matrix Multiplication


Submit solution

Points: 100
Time limit: 8.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++

You are given two \(n \times n\) matrices \(A\) and \(B\). Compute the bitwise xor of all entries in the product \(A \times B\).

Input

The first line contains a positive integer \(n\) (\(n \le 1200\)).

Each of the next \(n\) lines describes a row of matrix \(A\) as a string of length \(n\) consisting of digits 0 through 7; the digit in row \(i\), column \(j\) gives \(A_{i,j}\). The following \(n\) lines, in the same format, describe matrix \(B\).

Output

Output the xor of all elements of \(A \times B\).

Sample Input 1

2
76
05
56
46

Sample Output 1

127