Evolution
During research dedicated to the emergence of life on the planet Olympia, scientists made several sensational discoveries:
All living organisms on the planet originated from a single bacterium Bitozoria Programulis.
Evolution proceeded step by step (according to scientists' hypothesis—during climate changes on the planet).
At each step of evolution, exactly two subspecies formed from each species, and the previous species disappeared.
If the appearance of the bacterium Bitozoria Programulis is considered the first step of evolution, then the currently existing living organisms are at the -th step.
To avoid creating names during the research, scientists numbered all the species of organisms that ever existed on the planet. To do this, they drew an evolutionary tree with the root Bitozoria Programulis, which was assigned the number . Then, they numbered the species of each evolutionary step from left to right. Thus, the direct subspecies of Bitozoria Programulis were assigned the numbers and . Next, the species of the third step of evolution were numbered—the subspecies of species received the numbers and , and those of species received the numbers and , and so on.
Write a program that, given the numbers of two species, calculates the number of their closest common ancestor in the evolutionary tree.
Input
The first line contains the number of evolutionary stages that have occurred on the planet Olympia up to the present time. The second and third lines each contain a natural number representing the species numbers for which the closest common ancestor's number needs to be found.
Output
Output one natural number—the number of the closest ancestor for the two species.