while line = gets
  n = line.chomp.to_i

  answer = 0
  0.upto(1000) do |i|
    break if n - i < 0 || n - i > 3000
    0.upto(1000) do |j|
      break if n - i - j < 0 || n - i - j > 2000
      0.upto(1000) do |k|
        break if n - i - j - k < 0 || n - i - j - k > 1000
        0.upto(1000) do |l|
          answer += 1 if i + j + k + l == n
        end
      end
    end
  end

  puts answer
end