N, X, D = gets.split.map(&:to_i)

(puts X == 0 ? 1 : N + 1; exit) if D == 0
h = Hash.new{|h, k| h[k] = []}
(0 .. N).each do |n|
  l = n*X + n*(n - 1)/2*D
  r = n*X + n*(N - n + N - 1)/2*D
  h[l % D] << [l/D, r/D + 1]
end
ans = 0
h.values.each do |a|
  ee = -10**18
  a.sort.each do |s, e|
    next if ee > e
    ans += e - [s, ee].max
    ee = e
  end
end
puts ans