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

if d == 0
  p (x == 0)? 1 : (n+1)
  exit
end

x,d = -x,-d if d < 0

list = Hash.new{|h,k|h[k]=[]}

(0..n).each{|nn|
  div,mod = (x*nn).divmod(d)
  top = nn*(nn-1)/2 + div
  bottom = nn*(n-1+n-nn)/2 + div
  list[mod].push([top,:start],[bottom+1,:end])
}

cnt = 0
list.each{|m,l|
  nest = 0
  start = 0
  l.sort.each{|i,type|
    case type
    when :start
      start = i if nest == 0
      nest += 1
    when :end
      nest -= 1
      cnt += i - start if nest == 0
    end
  }
}
p cnt
