h, w = gets.split.map(&:to_i) w = w.abs ans = 0 k = 1 while k <= h l = k r = h+1 while r - l > 1 m = (l + r) / 2 if (w + m - 1) / m == (w + l - 1) / l l = m else r = m end end ans += (r - k) * ((w + k - 1) / k) k = r end puts ans