#include #include #include #include using namespace std; using u64 = uint64_t; constexpr u64 O = 1077, N = 1ULL << 51, M = N * 4011 + 1, M2 = M - 2, R2 = u64(-__uint128_t(M) % M); inline u64 MR(__uint128_t t) { u64 r = u64((__uint128_t(u64(t) * M2) * M + t) >> 64); return r < M ? r : r - M; } inline u64 init(u64 x) { return MR(__uint128_t(x) * R2); } inline u64 mod_mul(u64 x, u64 y) { return MR(__uint128_t(x) * y); } map, u64> cache; inline u64 mod_pow(u64 a, u64 n) { auto key = make_pair(a, n); if(cache.count(key)) { return cache[key]; } u64 res = init(1); for(; n; n>>=1) { if(n & 1) { res = mod_mul(res, a); } a = mod_mul(a, a); } return cache[key] = res; } void myfmt(vector &a, bool inv) { const size_t n = a.size(); for(size_t H=1, W=n>>1; H>=1) { vector y = a; u64 r = mod_pow(init(O), N/(H*2)); if(inv) { r = mod_pow(r, M2); } u64 w = init(1); for(size_t k=0; k= y1 ? y0 - y1 : y0 - y1 + M; } w = mod_mul(w, r); } } } void fmt(vector &a) { myfmt(a, false); } void ifmt(vector &a) { myfmt(a, true); size_t n = a.size(); u64 inv = mod_pow(init(n), M2); for(size_t i=0; i convol2(vector &a) { size_t n = 1; while(n < a.size() + a.size()) { n <<= 1; } a.resize(n); fmt(a); vector c(n); for(size_t i=0; i(powl(10, 5)) + 10; int main(void) { int n; u64 x; scanf("%d%lu", &n, &x); vector cnt(X); for(int i=0; i c = convol2(cnt); u64 res = 0; if(x < c.size()) { res = MR(c[x]); } printf("%lu\n", res); return 0; }