Copy Set Bits In A Range

easy
1. You are given two numbers A and B.
2. You are given two more numbers left and right, representing a range [left,right].
3. You have to set bits in B which are set in A lying in the above mentioned range.
4. Print the updated number B.

Input Format

4 numbers representing A,B,left and right.

Output Format

A number

Constraints

-10^9 <= A,B <= 10^9
1 < left < right < 32

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
10
13
2
3
Output
15
Previous
Flip Bits To Convert A To B
Next
Check Divisibility By 3

Related Questions