#include #define int long long using namespace std; const int mod = 1000000007; int D, R; int dp[2510][61]; int num_of_ways[2510][61]; bool got_ans[2510][61]; signed main() { cin >> D >> R; num_of_ways[0][0] = 1; got_ans[0][0] = true; for (int DIM = 1; DIM <= D; DIM++) { for (int SUM = 0; SUM <= R*R; SUM++) { for (int a = 0; a*a <= SUM; a++) { if (a == 0 && got_ans[SUM][DIM - 1]) { dp[SUM][DIM] += dp[SUM][DIM - 1]; num_of_ways[SUM][DIM] += num_of_ways[SUM][DIM - 1]; got_ans[SUM][DIM] = true; } else if (got_ans[SUM - a*a][DIM - 1]) { dp[SUM][DIM] += (2*(dp[SUM - a*a][DIM - 1]) + 2*num_of_ways[SUM - a*a][DIM - 1]*a); num_of_ways[SUM][DIM] += (2*num_of_ways[SUM - a*a][DIM - 1]); got_ans[SUM][DIM] = true; } dp[SUM][DIM] %= mod; num_of_ways[SUM][DIM] %= mod; } } } /* cout << D << " " << R << endl; for (int dm = 1; dm <= D; dm++) { for (int sm = 0; sm <= R*R; sm++) { cout << setw(3) << dp[sm][dm] << " "; } cout << endl; } */ int ans = 0; for (int summin = 0; summin <= R*R; summin++) { ans += dp[summin][D]; ans %= mod; } cout << ans << '\n'; return 0; } /* 3 5 0 2 0 0 4 0 0 0 0 6 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 10 0 4 6 0 8 18 0 0 12 12 24 0 0 30 0 0 16 30 18 0 36 0 0 0 0 62 0 6 16 14 14 48 54 6 34 84 68 72 36 82 156 12 36 174 134 104 104 188 116 20 116 148 1842 */