import Control.Applicative main :: IO () main = solve <$> flip div 4 <$> readLn >>= print solve :: Int -> Int solve l = f 0 1 2 where f c n m | 2 * (n + 1) * (2 * n + 1) > l = c `mod` 1000003 | 2 * m * (m + n) > l = f c (n + 1) (n + 2) | odd (m - n) && gcd n m == 1 = f (c + 1) n (m + 1) | otherwise = f c n (m + 1)