#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair P; typedef long long int llint; const int INF = 10000000; const llint LINF = 10000000000; const llint MOD = 1000000000; int main(){ int money,n; int karia,karib; llint ans[100000]; cin >> money; cin >> n; money = money - money % 1000; karia = 1000 * n; karib = money / karia; money = (money-karib*karia)/1000; ans[0] = 1; if (money == 1){ ans[n] = n; } for (int i = 0; i < money; i++){ ans[i + 1] = ans[i] * (n- i) / (i + 1); } cout << ans[money]%MOD; // cin >> n; return 0; }