import math import fractions L = int(input()) ans = 0 for m in range(1, int(math.sqrt(L//4)+1), 1): for n in range(1, m, 1): if (m-n) % 2 == 1: if ((m**2+n**2)+(2*m*n)+(m**2-n**2))*4 <= L: if fractions.gcd(m, n) == 1: ans += 1 else: break print(ans%1000003)