require 'set'
n,x,d=gets.split.map(&:to_i)

base = n*(n-1)/2

list = {}

(0..n).each{|nn|
  div,mod = (x*(n-nn-nn)).divmod(d)
  top = base - nn*(nn-1)/2 + div
  bottom = base - nn*(n-1+n-nn)/2 + div
  list[mod]||=[]
  list[mod].push([bottom,:start],[top,:end])
#  p [top,bottom]
}
ans = 0
list.each{|_,l|
  nest = 0
  start = 0
  l.sort.each{|i,k|
    case k
    when :start
      start = i if nest == 0
      nest += 1
    when :end
      nest -= 1
      ans += i - start if nest == 0
    end
#    p [nest,start,i,k]
  }
}
p ans
