def gcd(x,y): if (x,y) in Memo: return Memo[(x,y)] if x%y: return gcd(y,x%y) else: return y L=int(input()) Memo={} Mod=1000003 X=0 m=1 while 4*m*m<=L: for n in range(1,m): if gcd(m,n)!=1: continue if (m%2)^(n%2)==0: continue a=m*m-n*n b=2*m*n c=m*m+n*n if 4*(a+b+c)<=L: X+=1 m+=1 print(X%Mod)