import 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 tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int N=sc.nextInt();
      int L=sc.nextInt();

      int tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    }
} Main public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int N=sc.nextInt();
      int L=sc.nextInt();

      int tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    } main {
      Scanner sc = new Scanner(System.in);

      int N=sc.nextInt();
      int L=sc.nextInt();

      int tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    } 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 tasteN=0; tasteN 0 int tasteN1=0; tasteN1 0 int[] app = new int[N+1]; app new int[N+1] N+1 N 1 int[] dif = new int[N+1]; dif new int[N+1] N+1 N 1 int num=0; num 0 int min=999999; min 999999 for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
        tasteN+=L+i-1;
      } {
        tasteN+=L+i-1;
      } tasteN+=L+i-1 tasteN L+i-1 L+i L i 1 for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      } {
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      } for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        } int j=1; int j=1; j 1 j<=N j N j++ j++ j {
          if(j!=i){
            tasteN1+=L+j-1;
          }
        } {
          if(j!=i){
            tasteN1+=L+j-1;
          }
        } if(j!=i){
            tasteN1+=L+j-1;
          } j!=i j i {
            tasteN1+=L+j-1;
          } tasteN1+=L+j-1 tasteN1 L+j-1 L+j L j 1 app[i]=tasteN1 app[i] app i tasteN1 tasteN1=0 tasteN1 0 for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
        dif[i]=Math.abs(tasteN-app[i]);
      } {
        dif[i]=Math.abs(tasteN-app[i]);
      } dif[i]=Math.abs(tasteN-app[i]) dif[i] dif i Math.abs(tasteN-app[i]) Math.abs Math tasteN-app[i] tasteN app[i] app i for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      } {
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      } if(dif[i]<min){
          min=dif[i];
          num=i;
        } dif[i]<min dif[i] dif i min {
          min=dif[i];
          num=i;
        } min=dif[i] min dif[i] dif i num=i num i System.out.println(app[num]) System.out.println System.out System System.out app[num] app num 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 tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    }
} public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int N=sc.nextInt();
      int L=sc.nextInt();

      int tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    }
} Main
import 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 tasteN=0;
      int tasteN1=0;
      int[] app = new int[N+1];
      int[] dif = new int[N+1];

      int num=0;
      int min=999999;

      for(int i=1;i<=N;i++){
        tasteN+=L+i-1;
      }

      for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
          if(j!=i){
            tasteN1+=L+j-1;
          }
        }
        app[i]=tasteN1;
        tasteN1=0;
      }

      for(int i=1;i<=N;i++){
        dif[i]=Math.abs(tasteN-app[i]);
      }

      for(int i=1;i<=N;i++){
        if(dif[i]<min){
          min=dif[i];
          num=i;
        }
      }


      System.out.println(app[num]);

    }
}
