#include #include using namespace std; long long gcd(long long x, long long y) { do { if (x < y) { std::swap(x, y); } x = x % y; } while (x > 0LL); return y; } int main() { long long l; cin >> l; long long patterns = 0; long long total = l / 4; for (long long m = 1; m < (long long)sqrt(total); ++m) { for (long long n = 1; n < m; ++n) { if ((m - n) % 2 == 0) { continue; } if (gcd(m, n) > 1) { continue; } long long a = m * m - n * n; long long b = 2 * m * n; long long c = m * m + n * n; if (a + b + c > total) { continue; } if (a * a + b * b != c * c) { continue; } ++patterns; patterns %= 1000003; } } cout << patterns << endl; return 0; }