import math L=int(raw_input()) mod=1000003 triLen=L/4 def gcd(a,b): if a > b: return gcd(b,a) if b%a==0: return a return gcd(b%a,a) ans = 0 for n in range(1, int(math.sqrt(triLen))+1 ): for m in range(n+1, int(math.sqrt(triLen-n*n))+1 ): if gcd(m,n)==1 and (m-n)%2==1 and 2*m*m+2*m*n<=triLen: #print m*m+n*n,2*m*n,m*m-n*n ans+=1 print ans%mod