#include #include int each_prime(m, n) { long long int m1; long long int tmp; int flag; if(m < n){ tmp = m; m = n; n = tmp; } flag = 1; for(;;){ m1 = m % n; if(n == 1){ return 1; } if(m1 == 0){ return 0; } else if(m1 == 1){ return 1; } m = n; n = m1; } //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 < 2 * sqrt(l / 12);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; }