import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int l = sc.nextInt(); l sc.nextInt() sc.nextInt sc int nPi = 0; nPi 0 for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            nPi += l + i - 1;
        } {
            nPi += l + i - 1;
        } nPi += l + i - 1 nPi l + i - 1 l + i l i 1 int minDiff = Integer.MAX_VALUE; minDiff Integer.MAX_VALUE Integer Integer.MAX_VALUE int result = 0; result 0 for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        } {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        } int n1Pi = nPi - (l + i - 1); n1Pi nPi - (l + i - 1) nPi (l + i - 1) l + i l i 1 int diff = Math.abs(nPi - n1Pi); diff Math.abs(nPi - n1Pi) Math.abs Math nPi - n1Pi nPi n1Pi if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            } minDiff > diff minDiff diff {
                minDiff = diff;
                result = n1Pi;
            } minDiff = diff minDiff diff result = n1Pi result n1Pi System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int nPi = 0;
        for (int i = 1; i <= n; i++) {
            nPi += l + i - 1;
        }
        int minDiff = Integer.MAX_VALUE;
        int result = 0;
        for (int i = 1; i <= n; i++) {
            int n1Pi = nPi - (l + i - 1);
            int diff = Math.abs(nPi - n1Pi);
            if (minDiff > diff) {
                minDiff = diff;
                result = n1Pi;
            }
        }
        System.out.println(result);
    }

}
