import Data.List
main = do
  ns <- getContents
  let count = sum' 4
  mapM_  print . map (\n -> count !! (n + 4)) . map read $ lines ns
sum' :: Integer -> [Integer]
sum' 0 = [1] ++ (take 4001 [0,0..])
sum' n = f 0 (sum' (n - 1)) [0,0..]
f :: Int -> [Integer] -> [Integer] -> [Integer]
f n orig a
    | n /= 1001 = f (n + 1) ([0] ++ orig) $ zipWith (+) ([0] ++ orig) a
    | otherwise = a