import sequtils,strutils,math,algorithm const m = 1_000_003 var L = stdin.readline.parseInt cnt : int items = newSeq[tuple[x,y,z : int]](0) for a in 1..(floor(sqrt(L / 2)) / 2).int: for b in 0..(floor(sqrt(L / 2)) / 2).int: var x = abs(a * a * 4 - (b * 2 + 1) * (b * 2 + 1)) y = 2 * (2 * a) * (2 * b + 1) z = a * a * 4 + (b * 2 + 1) * (b * 2 + 1) if (x + y + z) * 4 <= L and gcd(x,y) == 1: cnt += 1 #echo @[x,y,z].join(" ") items.add((x,y,z)) cnt = cnt mod m echo cnt