cho.sh
Notes
Loading...

Sum of Largest Power-of-Two Divisors

Time limit

2s

Memory limit

128 MB

Problem

For a positive integer N, define f(N) as the largest divisor of N that is a power of two. Equivalently, if N can be divided by 2 exactly k times while remaining an integer, then f(N)=2^k. For example, f(15)=1 and f(40)=8.

Given positive integers A and B(A <= B), compute the sum of f(x) for every positive integer x from A through B.

f(A) + f(A+1) + ... + f(B)

Input

The first line contains two positive integers A and B separated by a space.

1 <= A <= B <= 10^15

Output

Print the required sum on the first line.