local mfl, mce = math.floor, math.ceil
local mmi, mma = math.min, math.max
local n, x, d = io.read("*n", "*n", "*n")
if d == 0 then
  print(n + 1)
  os.exit()
elseif d < 0 then
  x, d = -x, -d
end
local ret = 0
local min, max = 0, 0
local t = {}
t[0] = {}
table.insert(t[0], {0, 0})
for i = 1, n do
  min = min + i - 1
  max = max + n - i
  local v = x * i
  local quot = mfl(v / d)
  local rem = v - quot * d
  if rem < 0 then
    rem = rem + d
    quot = quot - 1
  end
  if not t[rem] then t[rem] = {} end
  table.insert(t[rem], {quot + min, quot + max})
end
for k, tbl in pairs(t) do
  table.sort(tbl, function(a, b) return a[1] < b[1] end)
  local curleft, curright = tbl[1][1], tbl[1][2]
  for i = 2, #tbl do
    local l, r = tbl[i][1], tbl[i][2]
    if l <= curright + 1 then
      curright = mma(curright, r)
    else
      ret = ret + (curright - curleft + 1)
      curleft, curright = l, r
    end
  end
  ret = ret + (curright - curleft + 1)
end
print(ret)
