#include int each_prime(m, n) { int m1; 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) { int m, n, l; int a, b, c; int count; scanf("%d", &l); count = 0; for(m = 2;m < 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("%d\n", count % 1000003); return 0; }