def num(i)
  if i <= 1000
    return i + 1
  else
    return 1000 - i % 1001
  end
end

readlines.map(&:to_i).each{|n|
  cnt = 0
  0.upto(n+1){|i|
    if n - i <= 2000 && i <= 2000
      cnt += num(i) * num(n-i)
    end
  }
  puts cnt
}