#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _MSC_VER #include #endif #define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i) #define rep(i, n) FOR(i, 0, n) #define ALL(v) v.begin(), v.end() #define REV(v) v.rbegin(), v.rend() #define MEMSET(v, s) memset(v, s, sizeof(v)) #define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end()) #define MP make_pair #define MT make_tuple using namespace std; typedef long long ll; typedef long double ld; typedef pair P; ll gcd(ll m, ll n){ return n ? gcd(n, m%n) : m; } int main(){ cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20); int L; cin >> L; L /= 4; ll N = sqrt(L); int cnt = 0; set> st; for (ll a = 1; a <= N; ++a){ for (ll b = a+1; b <= N; b += 2){ ll x = b*b - a*a, y = 2 * a*b, z = b*b + a*a; if (x+y+z <= L && gcd(x, gcd(y, z)) == 1){ ++cnt; } } } cout << cnt % 1000003 << endl; }