AlgoUniversity
  • Go Back
Discussion
Energy :

Author

Rishabh Verma

Difficulty Level : Medium

Submissions : 190

Asked In : Edfora

Marks :15

: 4 | : 0

There are an infinite number of identical photons. These photons are placed into containers, say nodes numbered from 1 with the first container being the root node.

The kth node has two children i.e., left and right child, numbered as 2*k and 2*k +1 respectively. When you throw a heat wave at a photon present at some node, it starts vibrating and produces a light of intensity -1. The vibration of this photon affects all the other photons as well.

As you go away from this node, the intensity of light produced by photons at various nodes decreases by 1. Initially, all the photons are stable.

Your task is to print the intensity of light produced by jth node, if the ith node was hit by a heat wave.

Input

A line contains two space separated integers i and j ($$$1 \le i,j \le 1e18$$$).

Output

print a single integers denotes the intensity of light produced by jth node.

Examples

Input
1 2
Output
-2
Input
1 1
Output
-1
Input
2 3
Output
-3

Note

In example 3 : The first node will produce light of intensity-1. The first node being the neighbor, will produce intensity-2. The third node being the neighbor of the first node and 2 nodes away from the second node will produce light of intensity -3. Therefore, -3 is returned as the output.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.