This problem is a programming version of Problem 167 from projecteuler.net
For two positive integers and , the Ulam sequence is defined by , and for , is the smallest integer greater than which can be written in exactly one way as the sum of two distinct previous members of .
For example, the sequence begins with
does not belong to it because has two representations as the sum of two previous members, likewise .
Find
Input Format
Two space-separated integers and are given on first line.
Constraints
Output Format
Print one integer which is the answer to the problem.
Sample Input 0
2 10
Sample Output 0
23
Explanation 0
Beginning of is