import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    }

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

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    }

} Main public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    } main {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    } try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        } {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        } Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int L = scanner.nextInt(); L scanner.nextInt() scanner.nextInt scanner long all = 0; all 0 for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
                all += (L + i - 1);
            } {
                all += (L + i - 1);
            } all += (L + i - 1) all (L + i - 1) L + i L i 1 long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE long answer = 0; answer 0 for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            } {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            } long apple = (L + i - 1); apple (L + i - 1) L + i L i 1 long rest = all - apple; rest all - apple all apple long diff = all - rest; diff all - rest all rest if (diff < 0) {
                    diff *= -1;
                } diff < 0 diff 0 {
                    diff *= -1;
                } diff *= -1 diff -1 1 if (diff < min) {
                    min = diff;
                    answer = all - apple;
                } diff < min diff min {
                    min = diff;
                    answer = all - apple;
                } min = diff min diff answer = all - apple answer all - apple all apple System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    }

} public class Main {

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int L = scanner.nextInt();

            long all = 0;
            for (int i = 1; i <= N; i++) {
                all += (L + i - 1);
            }
            long min = Long.MAX_VALUE;
            long answer = 0;
            for (int i = 1; i <= N; i++) {
                long apple = (L + i - 1);
                long rest = all - apple;
                long diff = all - rest;
                if (diff < 0) {
                    diff *= -1;
                }
                if (diff < min) {
                    min = diff;
                    answer = all - apple;
                }
            }
            System.out.println(answer);
        }
    }

}
