Ad

Intro
Jason is an integer k. It generates a special sequence A, and for each Ai in A there is: Ai = i & k.
He needs to find the sum of the frist k elements of the sequence.
Jason thinks it's really an easy task, so he throws it to you.

Input
line 1: three integers k

Output
line 1: the answer

Constraints
1<=k<=1e5

int kth(int k){
  //printf("%d\n",k);
  int ans=0;
  for(int i=0;i<k;++i) ans+=i&k;
  //printf("%d\n",ans);
  return ans;
}