
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
        solve();
    }

    public static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int ans = 20000;
        int counter = 0;

        for(int i=1;i<=n;i++){
        	counter += l + i - 1;
        }

        for(int i=1;i<=n;i++){
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        }

        System.out.println(ans);
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main{
    public static void main(String[] args){
        solve();
    }

    public static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int ans = 20000;
        int counter = 0;

        for(int i=1;i<=n;i++){
        	counter += l + i - 1;
        }

        for(int i=1;i<=n;i++){
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args){
        solve();
    } main {
        solve();
    } solve() solve String[] args args public static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int ans = 20000;
        int counter = 0;

        for(int i=1;i<=n;i++){
        	counter += l + i - 1;
        }

        for(int i=1;i<=n;i++){
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        }

        System.out.println(ans);
    } solve {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int ans = 20000;
        int counter = 0;

        for(int i=1;i<=n;i++){
        	counter += l + i - 1;
        }

        for(int i=1;i<=n;i++){
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        }

        System.out.println(ans);
    } 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 ans = 20000; ans 20000 int counter = 0; counter 0 for(int i=1;i<=n;i++){
        	counter += l + i - 1;
        } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
        	counter += l + i - 1;
        } {
        	counter += l + i - 1;
        } counter += l + i - 1 counter l + i - 1 l + i l i 1 for(int i=1;i<=n;i++){
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        } {
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        } int count = 0; count 0 for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	} int j=1; int j=1; j 1 j<=n j n j++ j++ j {
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	} {
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	} if(i == j){
        			continue;
        		} i == j i j {
        			continue;
        		} continue; count += l + j - 1 count l + j - 1 l + j l j 1 if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	} Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count)) Math.abs(Math.abs(counter) - Math.abs(ans)) Math.abs Math Math.abs(counter) - Math.abs(ans) Math.abs(counter) Math.abs Math counter Math.abs(ans) Math.abs Math ans Math.abs(Math.abs(counter) - Math.abs(count)) Math.abs Math Math.abs(counter) - Math.abs(count) Math.abs(counter) Math.abs Math counter Math.abs(count) Math.abs Math count {
        		ans = count;
        	} ans = count ans count System.out.println(ans) System.out.println System.out System System.out ans

import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] args){
        solve();
    }

    public static void solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        int ans = 20000;
        int counter = 0;

        for(int i=1;i<=n;i++){
        	counter += l + i - 1;
        }

        for(int i=1;i<=n;i++){
        	int count = 0;
        	for(int j=1;j<=n;j++){
        		if(i == j){
        			continue;
        		}
        		count += l + j - 1;
        	}
        	
        	if(Math.abs(Math.abs(counter) - Math.abs(ans)) > Math.abs(Math.abs(counter) - Math.abs(count))){
        		ans = count;
        	}
        }

        System.out.println(ans);
    }
}