#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using P = pair; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } struct mint { int x; mint() : x(0) {} mint(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} mint& operator+=(const mint& p){ if((x += p.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint& p){ if((x -= p.x) < 0) x += mod; return *this; } mint& operator*=(const mint& p){ x = (int)(1LL * x * p.x % mod); return *this; } mint& operator/=(const mint& p){ *this *= p.inverse(); return *this; } mint operator-() const { return mint(-x); } mint operator+(const mint& p) const { return mint(*this) += p; } mint operator-(const mint& p) const { return mint(*this) -= p; } mint operator*(const mint& p) const { return mint(*this) *= p; } mint operator/(const mint& p) const { return mint(*this) /= p; } bool operator==(const mint& p) const { return x == p.x; } bool operator!=(const mint& p) const { return x != p.x; } mint pow(int64_t n) const { mint res = 1, mul = x; while(n > 0){ if(n & 1) res *= mul; mul *= mul; n >>= 1; } return res; } mint inverse() const { return pow(mod - 2); } friend ostream& operator<<(ostream& os, const mint& p){ return os << p.x; } friend istream& operator>>(istream& is, mint& p){ int64_t val; is >> val; p = mint(val); return is; } }; template struct Combination{ int sz; vector fact_; vector ifact_; vector inv_; Combination(int n = 1e+6) : sz(n) { fact_.resize(sz + 1); ifact_.resize(sz + 1); inv_.resize(sz + 1); fact_[0] = ifact_[sz] = inv_[0] = 1; for(int i = 1; i <= sz; ++i) fact_[i] = fact_[i - 1] * i; ifact_[sz] /= fact_[sz]; for(int i = sz; i > 0; --i) ifact_[i - 1] = ifact_[i] * i; for(int i = 1; i <= sz; ++i) inv_[i] = ifact_[i] * fact_[i - 1]; } inline T fact(int k) const { if(k < 0 || k > sz) return 0; return fact_[k]; } inline T ifact(int k) const { if(k < 0 || k > sz) return 0; return ifact_[k]; } inline T inv(int k) const { if(k < 0 || k > sz) return 0; return inv_[k]; } T get_permutation(int n, int k){ if(n < 0 || k < 0 || n < k) return 0; return fact(n) * ifact(n - k); } T get_combination(int n, int k){ if(n < 0 || k < 0 || n < k) return 0; return fact(n) * ifact(k) * ifact(n - k); } }; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; Combination comb(M + 1); cout << comb.get_combination(M + 1, N + 1) << endl; return 0; }