import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    }
} 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 m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    }
} Main public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    } main {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int m=sc.nextInt(); m sc.nextInt() sc.nextInt sc if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1)); m>=0 m 0 System.out.println(n*(n-1)/2+m*(n-1)) System.out.println System.out System System.out n*(n-1)/2+m*(n-1) n*(n-1)/2 n*(n-1) n (n-1) n 1 2 m*(n-1) m (n-1) n 1 if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1)); n+m>0 n+m n m 0 System.out.println(n*(n-1)/2+m*n) System.out.println System.out System System.out n*(n-1)/2+m*n n*(n-1)/2 n*(n-1) n (n-1) n 1 2 m*n m n System.out.println(n*(n-1)/2+m*n-(n+m-1)) System.out.println System.out System System.out n*(n-1)/2+m*n-(n+m-1) n*(n-1)/2+m*n n*(n-1)/2 n*(n-1) n (n-1) n 1 2 m*n m n (n+m-1) n+m n m 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        if(m>=0)System.out.println(n*(n-1)/2+m*(n-1));
        else if(n+m>0)System.out.println(n*(n-1)/2+m*n);
        else System.out.println(n*(n-1)/2+m*n-(n+m-1));
    }
}
