#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) ll kai(ll num){ ll ans = num; for(int i = num - 1;i >= 1;i--){ ans %= 1000000000; ans *= i; } ans %= 1000000000; return ans; } ll mCn(ll m,ll n){ ll ans = kai(m) / (kai(m-n) * kai(n)); return ans ; } int main() { ll n,m,amari; cin >> n >> m; amari = n % (1000 * m); amari = amari / 1000 * 1000; amari /= 1000; if(amari == 0) cout << 1 << endl; else cout << mCn(m,amari) << endl; return 0; }