Given is an integer N. How many permutations (P_0,P_1,\cdots,P_{2N-1}) of (0,1,\cdots,2N-1) satisfy the following condition?

* For each i (0 \leq i \leq 2N-1), N^2 \leq i^2+P_i^2 \leq (2N)^2 holds.



Since the number can be enormous, compute it modulo M.

Constraints

* 1 \leq N \leq 250
* 2 \leq M \leq 10^9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N M


Output

Print the number of permutations that satisfy the condition, modulo M.

Examples

Input

2 998244353


Output

4


Input

10 998244353


Output

53999264


Input

200 998244353


Output

112633322
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << (x) << endl
using namespace std;

const int N = 255;

int n, r[N];
long long f[N << 1][N], mod, ans = 0ll;
vector<pair<int, int> > vec;
int main () {
	scanf("%d%lld", &n, &mod);
	for (int i = 0; i < n; i++) {
		r[i] = min((n << 1) - 1, (int)sqrt(4 * n * n - i * i));
		vec.push_back(make_pair((int)sqrt(n * n - 1 - i * i), -i));
	}
	for (int i = n; i < (n << 1); i++) vec.push_back(make_pair((int)sqrt(4 * n * n - i * i), -i));
	sort(vec.begin(), vec.end());
	
	for (int i = 0; i < (n << 1); i++) vec[i].second *= -1;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= i; j++) f[0][j] = 0ll;
		f[0][0] = 1ll % mod;
		for (int j = 0, cnt = 0; j < vec.size(); j++) {
			if (vec[j].second >= n) {
				for (int k = 0; k <= i; k++) {
					f[j + 1][k] = f[j][k] * (vec[j].first + 1 - (j + k - cnt)) % mod;
				}
			}
			else {
				cnt++;
				for (int k = 0; k <= i; k++) {
					f[j + 1][k] = f[j][k] * (r[vec[j].second] + 1 - ((n << 1) - 1 - vec[j].second - k + i)) % mod;
					if (k) f[j + 1][k] = (f[j + 1][k] + f[j][k - 1] * (vec[j].first + 1 - (j + k - cnt))) % mod;
				}
			}
		}
		if (i & 1) ans = (ans + mod - f[n << 1][i]) % mod;
		else ans = (ans + f[n << 1][i]) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}