cho.sh
Notes
Loading...

Trailing Zeros in a Combination

Time limit

2s

Memory limit

128 MB

Problem

Given integers nnn and mmm, determine how many consecutive zeros appear at the end of (nm)\binom{n}{m}(mn​) when it is written in decimal notation.

Input

The first line contains two integers nnn and mmm separated by a space.

The constraints are 0≤m≤n≤2,000,000,0000 \le m \le n \le 2,000,000,0000≤m≤n≤2,000,000,000 and n≠0n \ne 0n=0.

Output

Print the number of trailing zeros in (nm)\binom{n}{m}(mn​).