L = 1000
@memo = Array.new(3) {[]}

def doit(s, n = 1)
  return (s <= L) ? 1 : 0 if n == 4
  return @memo[n][s] if @memo[n][s]
  co = 0
  a = (s <= L) ? s : L
  (0..a).each do |i|
    co += doit(s - i, n + 1)
  end
  @memo[n][s] = co
end

$<.readlines.map(&:to_i).each do |s|
  puts doit(s)
end
