CSES - Aalto Competitive Programming 2024 - wk12 - Wed - Rabbits
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Far far away in the future, humanity has sent 11 frozen newborn rabbit pair to populate an alien planet. Each pair of rabbits reaches maturity at the age of 1 month and they immediately mate. One month after mating the pair reproduces one pair of rabbits, after which the older pair mates again immediately. The rabbits never die and continue breeding forever.

How many months will the rabbit population be in an interval between aa and bb?

Input:

The first line contains 2 integers a,ba,\,b: the interval boundaries.

Output:

Print a single integer dd: the duration (in months) when the number of rabbit pairs is in the interval [a,b][a,\,b] inclusive.

Constraints:

1ab101001 \leq a \leq b \leq 10^{100}

Example:

Input:

3 5

Output:

2

Explanation:

During 1st1^{st} month: 11 pair of newborn rabbits. No mating.

During 2nd2^{nd} month: still 11 pair of rabbits, 11 pair mates at the beginning of the month and at the end of the month you'll have 11 new pair of newborns.

During 3rd3^{rd} month: now there are 22 pairs of rabbits. The older pair mates at the beginning of the month and at the end of the month you'll have 11 new pair of newborns.

During 4th4^{th} month: 33 pairs of rabbits, 22 of which mate. At the end of the 4th4^{th} month you'll have 22 new pairs of newborns.

During 5th5^{th} month: 55 pairs of rabbits, 33 of which mate. At the end of the 4th4^{th} month you'll have 33 new pairs of newborns.