#include #include #include using namespace std; const int MOD = (int)1e9; vector> get_combination(int ma) { vector> mat(ma + 1, vector(ma + 1)); for (int n = 0; n <= ma; n++) mat[n][0] = 1; for (int n = 1; n <= ma; n++) for (int r = 1; r <= n; r++) { mat[n][r] = (mat[n - 1][r - 1] + mat[n - 1][r]) % MOD; } return mat; } int main() { vector> comb = get_combination(10000); long long n, m; cin >> n >> m; cout << comb[m][n / 1000 % m] % MOD << endl; return 0; }