readlines.map(&:to_i).each{|n|
  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)
      start = [b, cd - 1000].max
      num = [cd/2-start, 1000-cd/2].min
      it = 0
      if abflag
        if cdflag
          if bcflag
            it = 1
          else
            if num > 0
              it = 4+12*num - 6
            else
              it = 6
            end
          end
        else
          if num > 0
            it = 4+12*num
          else
            it = 12
          end
        end
      else
        if cdflag
          if bcflag
            it = 4+24*num
          else
            if num > 0
              it = 12+24*num - 12
            else
              it = 12
            end
          end
        else
          if num > 0
            it = 12+24*num
          else
            if bcflag
              it = 12
            else
              it = 24
            end
          end
        end
      end
#      p [a, b, [start, cd-start], [cd/2, cd-cd/2], num, it]
      cnt += it
    }
  }
  puts cnt
}