import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int H = sc.nextInt(), W = Math.abs(sc.nextInt());
			if (H < 0 || H > 1000000000) System.exit(1);
			else if (W > 1000000000) System.exit(1);
			if (W == 0) { // 自明な0手
				System.out.println(0);
			} else {
				long ans = H++;
				for (long i = 1, j = 1;;j += i++) {
					if (j + i <= Math.min(H, W)) {
						ans += i * i;
					} else { // 終端処理
						long dist = Math.min(H, W) - j;
						ans += i * dist;
						if (W <= H) break;
						ans += (i * i - (i - dist)) * ((W - H) / i);
						ans += i * ((W - H) % i);
						ans -= Math.min(i - dist, (W - H) % i);
						break;
					}
				}
				System.out.println(ans);
			}
		}
	}
}