St Andrews Online Judge

Silver Ratio

By Kay Akashi

Time: 1000 ms
Memory: 256000 kB

The code judging system is only available during contests. Check out the github repo for test cases and solutions.

Please log in.

Problem Statement

You will think of a recursion an+2=pan+1+qana_{n + 2} = pa_{n + 1} + qa_{n} (a1=1,a2=1)(a_{1} = 1, a_{2} = 1).

Given integers qq and dd, find pp such that limn(an+1an)=d\lim_{n \to \infty} (\frac{a_{n + 1}}{a_{n}}) = d. In output, round pp to the nearest integer.

Constraints

1q,d10001 \leq q, d \leq 1000.

Input

The input consists of two integers, qq and dd.

Output

Output the answer. Make sure the answer is rounded to the nearest integer.

Examples

Input

33 972

Output

972

Input

891 533

Output

531