Category

Similar Problems

0797. Bitwise operation

Time limit : 1000 ms
Memory limit : 64 mb

In digital computer programming, a bitwise operation operates on one or more bit patterns or binary numerals at the level of their individual bits. It is a fast, primitive action directly supported by the processor, and is used to manipulate values for comparisons and calculations.

On simple low-cost processors, typically, bitwise operations are substantially faster than division, several times faster than multiplication, and sometimes significantly faster than addition. While modern processors usually perform addition and multiplication just as fast as bitwise operations due to their longer instruction pipelines and other architecturaldesign choices, bitwise operations do commonly use less power because of the reduced use of resources.

A bitwise OR takes two bit patterns of equal length and performs the logical inclusive OR operation on each pair of corresponding bits. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1; otherwise, the result is 0. For example:

   0101 (decimal 5)

OR 0011 (decimal 3)

 = 0111 (decimal 7)

The bitwise OR may be used to set the selected bits to 1. For example, it can be used for setting a specific bit (or flag) in a register, where each bit represents an individual Boolean state. Thus, 0010 (decimal 2) can be considered a set of four flags, where the first, third, and fourth flags are clear (0) and the second flag is set (1). The fourth flag may be set by performing a bitwise OR between this value and a bit pattern with only the fourth bit set:

   0010 (decimal 2)

OR 1000 (decimal 8)

 = 1010 (decimal 10)

This technique is an efficient way to store a number of Boolean values using as little memory as possible.

In this task you are given two numbers L and R. You should calculate bitwise OR operation of numbers from L to R inclusive.

Input

In the first line given integer numbers L and R(1≤LR≤1018).

Output

Output the answer to the problem.

Examples

Input

Output

1

4 6

7

2

10 10     

10

 

Avtor: Azat Yusupov
2015 yil Dasturlash bo'yicha Tatu va uning filiallari talabalari o'rtasida jamoaviy olimpiada. Final. Urgench 21-23 aprel.