from math import gcd l = int(input()) ans = set() for m in range(10**4 + 1): for n in range(1, m): if 8 * m * (m + n) > l: break L = [m**2 - n**2, 2 * m * n, m**2 + n**2] g = gcd(L[0], gcd(L[1], L[2])) L.sort() for i in range(3): L[i] //= g ans.add(tuple(L)) print(len(ans) % 1000003)