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

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