import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long l = sc.nextLong(); long ans = 0; long MOD = 1000003; for(long a = 2; (a * a * 8) < l; a++) { for(long b = 1; b < a; b++) { if((8 * a * a + 8 * a * b) <= l) { if(gcd(a, b) == 1) ans = (ans + 1) % MOD; } } } System.out.println(ans); } public static long gcd(long x, long y) { if(y == 0) return x; return gcd(y, (x % y)); } }