#https://atcoder.jp/contests/abc147/submissions/8987397

def max(a, b)
  a>b ? a:b
end

def main()
  h = Hash.new{|k,v| k[v]=[]}
  if D == 0
    if X == 0
      puts 1
      return
    else
      puts N+1
      return
    end
  end

  (N+1).times do |k|
    l = k*(k-1)/2
    r = k*(2*N-k-1)/2
    a = k*X + D*l
    b = k*X + D*r
    h[a%D] << [a/D, b/D + 1]#理解できず
  end
  
  ans = 0
  h.values.each do |a|
    savepoint = -INF
    a.sort.each do |sta, en|
      next if savepoint > en
      ans += en - max(sta, savepoint)
      savepoint = en
    end
  end
  puts ans
end

N, X, D = gets.split.map(&:to_i)
INF = Float::INFINITY
main