#include using namespace std; int N; void read() { cin >> N; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } void work() { int ans = 0; for (int m = 1; m * m <= N; ++m) for (int n = 1; n < m && m * m + n * n <= N; ++n) { if (gcd(m, n) != 1) continue; if (m % 2 == n % 2) continue; int a = m * m - n * n; int b = 2 * m * n; int c = m * m + n * n; if (4 * (a + b + c) > N) break; ++ans; } cout << ans % 1000003 << endl; } int main() { read(); work(); return 0; }