Limits 1s, 512 MB · Custom Checker

Exclusive-OR (or XOR) is a logical operation, which outputs 1 only when two input bits are different, output 0 otherwise. Here’s the truth table of XOR operation between two bits.

We can do XOR operation between two or more Integers. Generally, we use the symbol “⊕” to express xor operation. But in Java and C++, “^” is used as xor-operator for any calculation. For examples, 5 ^ 7 = 2 and 1 ^ 2 ^ 3 = 0.

So what happens when we perform XOR operation between two decimal numbers? Suppose A = 10 and B = 13. The binary representation of 10 and 13 are respectively 1010 and 1101. Now if we XOR A and B then we'll get 7 as the output. The table below shows how we get 10 ⊕ 13 = 7.

Here are some interesting properties of XOR operation:

  1. Commutative: A ⊕ B = B ⊕ A
    This is clear from the definition of XOR. It doesn’t matter which way round you order the two inputs, ie 10 ⊕ 13 = 7 and also 13 ⊕ 10 = 7.

  2. Associative: A ⊕ ( B ⊕ C ) = ( A ⊕ B ) ⊕ C
    This means that XOR operations can be chained together and the order doesn’t matter. If you aren’t convinced of the truth of this statement, try drawing the truth tables.

  3. Identity element: A ⊕ 0 = A
    This means that any value XOR’d with zero is left unchanged, ie 10 ⊕ 0 = 10, 0 ⊕ 13 = 13 etc.

  4. Self-inverse: A ⊕ A = 0
    This means that any value XOR’d with itself gives zero, ie 10 ⊕ 10 = 0, 13 ⊕ 13 = 0 etc.

In this problem, you will be given a positive integer X. You have to print any three positive numbers such that XOR of those three numbers is equal to X.

Input

Input will be one positive integer XX, value of XX will be less than 2×1092 \times 10^9 and greater than 0.

Output

Print any three positive integers such that XOR of these 3 integers is equal to XX. Each of the three Integers must be less than 2×1092 \times 10^9 and greater than 0. If there are multiple solutions, print any of them.

Samples

InputOutput
6
2 3 7

In the sample test cases, 2 ⊕ 3 ⊕ 7 = 6 and 5 ⊕ 7 ⊕ 8 = 10. Please note that 2 3 7 is not the only correct answer for the first case. Another correct answer can be 9 10 5, as 9 ⊕ 10 ⊕ 5 = 6.

InputOutput
10
5 7 8

Submit

Login to submit.

Statistics

92% Solution Ratio
allllekssssaEarliest, Jul '18
muzahid.islamFastest, 0.0s
DragneelLightest, 0 B
mdvirusShortest, 21B
Toph uses cookies. By continuing you agree to our Cookie Policy.