#include <iostream>
using namespace std;
int R,D, sol, main_two, main_five, two, five;
int get_pow(long long N, long long P) {
int nr = 0;
while(P <= N) {
nr += N / P;
P = P * P;
}
return nr;
}
int main() {
// your code goes here
cin >> R >> D;
main_two = get_pow(R, 2);
main_five = get_pow(R, 5);
for (int j = 0; j<= R; j++) {
two = main_two - get_pow(j, 2) - get_pow(R - j, 2);
five = main_five - get_pow(j, 5) - get_pow(R - j, 5);
if (two >= get_pow(D, 2) && five >= get_pow(D, 5))
sol++;
}
cout << sol;
return 0;
}