import sys import math def count_shapes(L): mod = 1000003 if L < 4: return 0 max_total = L // 4 # 因为4*(a + b + c) <= L count = 0 max_m = int(math.sqrt(max_total // 2)) + 1 # 因为 a + b + c = 2m(m + n) for m in range(2, max_m + 1): for n in range(1, m): if math.gcd(m, n) != 1: continue if (m % 2 == 0 and n % 2 == 0) or (m % 2 != 0 and n % 2 != 0): continue a = m*m - n*n b = 2 * m * n if a > b: a, b = b, a c = m*m + n*n total = 4 * (a + b + c) if total <= L: count += 1 return count % mod def main(): L = int(sys.stdin.readline()) print(count_shapes(L)) if __name__ == "__main__": main()