#include using namespace std; const int r_max = 2500; int min_p[r_max + 10]; int use_p[20]; int gcd(int a, int b){ if(b == 0)return a; return gcd(b, a % b); } int lcm(int a, int b){ return a / gcd(a, b) * b; } int max_m(int L, int n){ int m = (int)((sqrt(2 * L + 4 * n * n) - 2 * n) / 4) - 2; m = max(n + 1, m); while(8 * m * (n + m) <= L)++m; --m; return m; } int solve(int size, int upper){ if(use_p[0] != 2)upper /= 2; int res = upper; for(int mask=1;mask<1<> i) & 1){ L = lcm(L, use_p[i]); ++cnt; } if(cnt % 2 == 1){ res -= upper / L; } else { res += upper / L; } } return res; } int solve(int L){ int res = max_m(L, 1) / 2; for(int n=2;8*(n+1)*(2*n+1)<=L;n++){ int size = 0; use_p[size++] = min_p[n]; int t = n / min_p[n]; while(t > 1){ if(use_p[size-1] != min_p[t]){ use_p[size++] = min_p[t]; } t /= min_p[t]; } res += solve(size, max_m(L, n)) - solve(size, n); } return (res % 1000003); } int main(){ for(int n=2;n<=r_max;n++)min_p[n] = n; for(int p=2;p*p<=r_max;p++)if(min_p[p] == p){ for(int kp=p*p;kp<=r_max;kp+=p)if(p < min_p[kp]){ min_p[kp] = p; } } int L; cin >> L; cout << solve(L) << endl; return 0; }