MAX_SUM = 4000
MAX_I = 1000
K = 4
 
$sn_cache = Array.new(K + 1) {[]}
 
def check_sum(k, n)
  unless $sn_cache[k][n]
    count = 0
    max_i = [MAX_I, n].min
 
    (0..max_i).each do |i|
      count += check_sum(k - 1, n - i)
    end
 
    $sn_cache[k][n] = count
  end
  
  $sn_cache[k][n]
end
 
$sn_cache[1] = Array.new(MAX_I + 1, 1) + Array.new(MAX_SUM - MAX_I, 0)
 
while (line = gets)
  n = line.chomp.to_i
  puts check_sum(K, n)
end
