readlines.map(&:to_i).each{|n|
  n = 4000 - n if n >= 2000
  cnt = 0
  1001.times{|a|
    break if n - a < 0
    next if n - a > 3000
    a.upto(1001){|b|
      break if n - a - b < 0
      next if n - a - b > 2000
      abflag = (a == b ? true : false)
      cd = n - a - b
      next if cd > 2000
      break if cd / 2 < b
      cdflag = (cd - cd/2 == cd / 2 ? true : false)
      bcflag = (b == cd / 2 ? true : false)
      num = [cd/2-b, 1000-cd/2].min
      if abflag
        if cdflag
          if bcflag
            cnt += 1
          else
            if num > 0
              cnt += 4+12*num - 6
            else
              cnt += 6
            end
          end
        else
          cnt += 4+12*num
        end
      else
        if cdflag && bcflag
          cnt += 4+24*num
        elsif cdflag
          if num > 0
            cnt += 12+24*num - 12
          else
            cnt += 12
          end
        else
          cnt += 12+24*num
        end
      end
    }
  }
  puts cnt
}