import math MOD = 1000003 l = int(input()) cnt = {} for x in range(1, int(math.sqrt(l)) + 1): for y in range(1, x): a, b, _ = sorted([x ** 2 - y ** 2, x ** 2 + y ** 2, 2 * x * y]) g = math.gcd(a, b) a //= g b //= g if not cnt.get((a, b), None) is None: continue c = int(math.sqrt(a * a + b * b)) if a + b + c > l // 4: continue if a * a + b * b == c * c: cnt[(a, b)] = 1 else: cnt[(a, b)] = 0 print(sum(list(cnt.values())) % MOD)