Submissions will no longer be placed on the leaderboard. You may still attempt this problem for practice.

Complex physics experiments often have an underlying simple mathematical structure. In one such experiment that compares mathematical and empirical values, you are given three integer arrays, and asked to compute the experiment result mathematically.

From the given input arrays , , and , you are required to generate arrays , , and , each of equal length , based on the following function.

A function is defined for a given , where a value of is chosen such that is maximum where .

Let the modulo . Your task is to find .

Arrays , , and are generated from , , and , as follows:

where ( is a bitwise xor operation).

For example, given = , = , =

1 3 4 0 1 3*4 - 3*4 0
2 4 9 0 1 9*3 - 4*4 11

Complete the function expertComputation that takes 3 integer arrays as input, and return a single integer denoting the appropriate value for .

Input Format

The first line contains a single integer denoting the length of the arrays.

Next lines contain arrays , , and , respectively.

Constraints

  • where .

Output Format

Output the appropriate answer.

Sample Input 0

5
3 4 14 5 6
4 9 12 8 9
0 0 9 12 13

Sample Output 0

17

Explanation 0

Given that,

=
=
=

For every value of from to ,

1 3 4 0 1 3*4 - 3*4 0
2 4 9 0 1 3*9 - 4*4 11
3 5 7 2 1 3*7 - 4*5 12
4 9 4 0 4 4*9 - 4*9 12
5 10 5 1 4 5*9 - 4*10 17

From the table it is clear that,

=
=
=

Before computing in every step, choose in such a way that the maximum value of can be obtained.

For example, in the case of ,

Hence,

  • which is the maximum value.

When is computed in a similar manner for all values of , would be for each respectively. So the answer is

Sample Input 1

3
2 6 4
1 9 11
0 0 14

Sample Output 1

18
Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score