L = 1000
meno = {}

f1 = ->(n) {(n ** 3 + 6 * n ** 2 + 11 * n + 6) / 6}
f2 = ->(n) {(n ** 2 + 3 * n + 2) / 2}
f3 = ->(n) {n + 1}

f = ->(s, n) {
  case n
  when 1 then f1.(s)
  when 2 then f2.(s)
  when 3 then f3.(s)
  when 4 then 1
  else nil
  end
}

doit = ->(s, n = 1) {
  co = 0
  return f.(s, n) if s <= L
  return 0 if n == 4
  
  key = [s, n]
  return memo[key] if memo.has_key?(key)
  
  (0..L).each do |i|
    co += doit.(s - i, n + 1)
  end
  memo[key] = co
}

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