
import java.util.Scanner;

class Main {
    
    public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int d = scan.nextInt();
        int fl = 0 , min = d , sum =0; 
        for(int i =2 ; i<=n ; i++){
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        }
        
        System.out.println(sum);
    }
} import java.util.Scanner; Scanner java.util class Main {
    
    public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int d = scan.nextInt();
        int fl = 0 , min = d , sum =0; 
        for(int i =2 ; i<=n ; i++){
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        }
        
        System.out.println(sum);
    }
} Main public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int d = scan.nextInt();
        int fl = 0 , min = d , sum =0; 
        for(int i =2 ; i<=n ; i++){
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        }
        
        System.out.println(sum);
    } main {
         Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int d = scan.nextInt();
        int fl = 0 , min = d , sum =0; 
        for(int i =2 ; i<=n ; i++){
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        }
        
        System.out.println(sum);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int d = scan.nextInt(); d scan.nextInt() scan.nextInt scan int fl = 0 fl 0 min = d min d sum =0; sum 0 for(int i =2 ; i<=n ; i++){
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        } int i =2 ; int i =2 ; i 2 i<=n i n i++ i++ i {
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        } {
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        } fl = (d+i)-1 fl (d+i)-1 (d+i) d i 1 if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            } Math.abs(fl)<Math.abs(min) Math.abs(fl) Math.abs Math fl Math.abs(min) Math.abs Math min {
                sum+=min ;
                min = fl ;
            } sum+=min sum min min = fl min fl {
                sum+=fl ;
            } sum+=fl sum fl System.out.println(sum) System.out.println System.out System System.out sum String[]args args

import java.util.Scanner;

class Main {
    
    public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int d = scan.nextInt();
        int fl = 0 , min = d , sum =0; 
        for(int i =2 ; i<=n ; i++){
            
            fl = (d+i)-1;
            if(Math.abs(fl)<Math.abs(min)){
                sum+=min ;
                min = fl ;
            } else{
                sum+=fl ;
            }
        }
        
        System.out.println(sum);
    }
}