Problem Statement  
Let the function F(N) be a number of ones in the binary representation of the number N. For example F(279)=5 because 279 = (100010111)_{2}. The sequence X is constructed using the following rules. The initial element X_{0} is 0, and each successive elements X_{i} is A * F(X_{i1}) + B. You will be given integers A, B and K. Your method should return the X_{K} element. See examples for further explanation.  
Definition  
 
Constraints  
  A will be between 0 and 1000000, inclusive.  
  B will be between 0 and 1000000, inclusive.  
  K will be between 1 and 1000000000, inclusive.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
