import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = mapM_ print =<< (map solve) <$> getc toInt

solve :: Int -> Int
solve x = (sum . map (count x 3)) [0..1000]

count :: Int -> Int -> Int -> Int
count s n i
  | n == 0 = if s == i then 1 else 0
  | s < i = 0
  | otherwise = (sum . map (count (s - i) (n - 1))) [0..1000]

toInt :: String -> Int
toInt s = read s

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents