#include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,b) for(i=a;i-1;j--) { com[j] *= n-i; if(com[j] >= NUM) kuriagari(com,j); } } for(i=0;i-1;j--) { com[j] /= r-i; if(com[j] >= NUM) kuriagari(com,j); } } for(j=0;j<10001;j++) { if(com[j] >= NUM) kuriagari(com,j); } } void dekaiprint(ull a[],ull num) { long i,j; for(i=num-1;;i--) { if(a[i]) { printf("%llu",a[i]); break; } } i--; for(;i>-1;i--) printf("%0llu",a[i]); printf("\n"); } int main(void) { ull n,m; ull com[10001] = {1,0}; cin >> n >> m; n /= 1000; combi(com,m,n%m); dekaiprint(com,10001); return 0; }