
119  ZOJ Monthly, August 2012  G
We define that g(x) = x^(x/2) h_{1}(x) = x / m_{1} * m_{1} + ( x + s_{1}) % m_{1} h_{2}(x) = x / m_{2} * m_{2} + ( x + s_{2}) % m_{2} f(x) = g( h_{2}( g( h_{1}( g( x ) ) ) ) ) All above are integer arithmetic, and '^' is binary xor, for example, 8/3 = 2 , 5 ^ 12 = 9. m_{1}, m_{2}, s_{1}, s_{2} are 4 positive integers less than 345678, and fixed in all cases. But they are not explicitly given, you should guess them from the sample. (0.3m_{1} < s_{1}< m_{1}, 0.3m_{2} < s_{2}<m_{2}) What's more, your submission limit is 1KB! InputEach line is a case. Every case is an integer x,( 0≤ x< 2^{32}). OutputEach case a line, please output f(x). Sample InputSample OutputHintPlease download the sample. Every case in test is also in sample. Author: ZHOU, Yuchen 