#include #include int each_prime(long long int m, long long int n) { long long int r; long long int tmp; if(m < n){ tmp = m; m = n; n = tmp; } for(;;){ if(n == 1){ return 1; } r = m % n; if(r == 0){ return 0; } else if(r == 1){ return 1; } m = n; n = r; } //printf("%d\n", flag); //return flag; } int main(void) { long long int m, n, l; long long int a, b, c; long long int count; scanf("%lld", &l); count = 0; for(m = 2;m < sqrt(l / 4);m++){ for(n = 1;n < m;n++){ //printf("%d, %d\n", m, n); if((m - n) % 2 == 1 && each_prime(m, n) == 1){ a = m * m - n * n; b = 2 * m * n; c = m * m + n * n; if((a + b + c) * 4 <= l){ //printf("%d, %d:(%d, %d, %d)\n", m, n, a, b, c); count++; } } } } printf("%lld\n", count % 1000003); return 0; }