H, W = map(int, input().split()) d = abs(W) if H == 0 or d == 0: print(0) else: total = 0 for i in range(H): current_H = H - i if current_H >= d: total += 1 else: total += 2 * (d - current_H) print(total)