Good Bye 2022: 2023 is NEAR |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

bitmasks

combinatorics

dp

math

number theory

*3100

No tag edit access

The problem statement has recently been changed. View the changes.

×
F. Koxia and Sequence

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputMari has three integers $$$n$$$, $$$x$$$, and $$$y$$$.

Call an array $$$a$$$ of $$$n$$$ non-negative integers good if it satisfies the following conditions:

- $$$a_1+a_2+\ldots+a_n=x$$$, and
- $$$a_1 \, | \, a_2 \, | \, \ldots \, | \, a_n=y$$$, where $$$|$$$ denotes the bitwise OR operation.

The score of a good array is the value of $$$a_1 \oplus a_2 \oplus \ldots \oplus a_n$$$, where $$$\oplus$$$ denotes the bitwise XOR operation.

Koxia wants you to find the total bitwise XOR of the scores of all good arrays. If there are no good arrays, output $$$0$$$ instead.

Input

The first line of input contains three integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \leq n < 2^{40}$$$, $$$0 \leq x < 2^{60}$$$, $$$0 \leq y < 2^{20}$$$).

Output

Output a single integer — the total bitwise XOR of the scores of all good arrays.

Examples

Input

3 5 3

Output

2

Input

100 0 100

Output

0

Input

79877974817 749875791743978 982783

Output

64

Note

In the first test case, there are $$$12$$$ good arrays totally as follows.

- $$$[0,2,3]$$$, $$$[0,3,2]$$$, $$$[2,0,3]$$$, $$$[2,3,0]$$$, $$$[3,0,2]$$$ and $$$[3,2,0]$$$ — the score is $$$0 \oplus 2 \oplus 3 = 1$$$;
- $$$[1, 2, 2]$$$, $$$[2, 1, 2]$$$ and $$$[2, 2, 1]$$$ — the score is $$$1 \oplus 2 \oplus 2 = 1$$$;
- $$$[1, 1, 3]$$$, $$$[1, 3, 1]$$$ and $$$[3, 1, 1]$$$ — the score is $$$1 \oplus 1 \oplus 3 = 3$$$.

Therefore, the total bitwise xor of the scores is $$$\underbrace{1 \oplus \ldots \oplus 1}_{9\text{ times}} \oplus 3 \oplus 3 \oplus 3 = 2$$$.

In the second test case, there are no good sequences. The output should be $$$0$$$.

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/07/2023 23:56:00 (j3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|