/* -*- coding: utf-8 -*- * * 1186.cc: No.1186 長方形の敷き詰め - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_M = 1000000; const int MOD = 998244353; /* typedef */ typedef long long ll; /* global variables */ int fs[MAX_M + 1], invfs[MAX_M + 1]; /* subroutines */ int powmod(int a, int n) { // a^n % MOD int pm = 1; while (n > 0) { if (n & 1) pm = (ll)pm * a % MOD; a = (ll)a * a % MOD; n >>= 1; } return pm; } inline int nck(int n, int k) { // nCk % MOD return (ll)fs[n] * invfs[n - k] % MOD * invfs[k] % MOD; } void prepare_fracs(int n) { fs[0] = invfs[0] = 1; for (int i = 1; i <= n; i++) { fs[i] = (ll)fs[i - 1] * i % MOD; invfs[i] = powmod(fs[i], MOD - 2); } } /* main */ int main() { int n, m; scanf("%d%d", &n, &m); prepare_fracs(m); int sum = 0; for (int i = 0; i * n <= m; i++) { int j = m - i * n; sum = (sum + nck(i + j, i)) % MOD; } printf("%d\n", sum); return 0; }