#P9309. Santa's Gifts Distribution

    ID: 22464 Type: Default 1000ms 256MiB

Santa's Gifts Distribution

Santa's Gifts Distribution

Santa is preparing for Christmas 2021 and he wants to buy a positive number of gifts such that they can be evenly distributed among any number of well-behaved children. However, he does not know exactly how many such children there are, he only knows that the number of children x lies in the range \(x \in \{a, a+1, \ldots, b\}\). Santa wants to purchase the minimum number of gifts that can be evenly divided by every number in the range \([a, b]\) and then determine the number of trailing zeros (in base 10) in that number.

The minimal number of gifts is given by the least common multiple (LCM) of all integers from \(a\) to \(b\). Since the number might be extremely large, you are only required to output the number of trailing zeros of this number in its decimal representation. Recall that the number of trailing zeros of a number is determined by the exponent of 10 in its prime factorization, i.e. \(\min(v_2, v_5)\), where \(v_p\) is the highest power of prime \(p\) dividing the number.

More formally, for a given prime \(p\) (either 2 or 5), let \(e_p\) be the maximum integer such that there exists some \(x \in [a, b]\) with \(p^{e_p} \mid x\). Then the answer is:

[ \text{Answer} = \min(e_2, e_5). ]

You need to compute and output this result.

inputFormat

The input consists of a single line containing two integers a and b (1 \(\leq a \leq b\)) separated by spaces.

outputFormat

Output a single integer which is the number of trailing zeros in the minimum number of gifts that Santa needs to buy.

sample

1 10
1