Muhammad al Xorazmiy nomidagi TATU Urganch filiali talabalari uchun sovrinli musobaqa 2-turi

Problem Tasks

# Date State
Not Contest

# Date State

F. Odd Divisors

Time limit : 1000 ms
Memory limit : 64 mb

 Let f(x) be the greatest odd divisor of x, where x is a positive integer. You are given a positive integer n. Find f(1) + f(2) + ... + f(n).

   Input

   Each line contains one positive integer n (n ≤ 109).

   Output

   For each input n print in a separate line the value of f(1) + f(2) + ... + f(n).

Input

Output

1

7         

21

2

1

1

3

777

201537

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com