АВТ
Language: Russian
English

Remote Training on Programming

Problems Online status Contests
News FAQ E-learning
For authors:
Register  ||  Login
 
Hello, Guest! Please login or register.

1143. Function

Time Limit: 1 seconds
Memory Limit:65536KB
Points:100
View Problem Statistics Submit Problem added debug

Условия с турнира школьников на русском языке

One can determine the Gray code by its number using a very simple function: G(x) = x xor (x div 2), where xor stands for bitwise exclusive OR (bitwise modulo 2 addition), and div means integer division. It is interesting to note that function G(x) is invertible, which means it is always possible to uniquely restore x given the value of G(x).

Write a program to restore number x from the given value of G(x).

 

Limitations

0 <= x, y <= 109.

 

Input

The input file contains an integer number y, the value of G(x).

 

Output

The output file should contain a single integer x such that G(x) = y.

 

Example

Input

Output

15

10

 

Input

Output

1723

1234

 

All Rybinsk-2012 problems (in PDF)


View Problem Statistics Submit Problem discussion Author/source:
Problems from Contests and Camps / World Championship in Programming (ICPC) / Rybinsk-2012 /
1142. F - GCDs 1143. 1144. H - Milestones 1145. I - Dunno 1146. J - Computer Network
Problems from Contests and Camps / World Championship in Programming (ICPC) / School-Rybinsk-2012 /
1138. B - Island 1143. 1148. D - Raspberry 1139. E - Sequence. 1144. F - Milestones
time generating 1.015 sec.
© Copyright VSU, AVT, Nosov D.A., Andrianov I.A.