import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int K = Integer.parseInt(sc.next()); K Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 0; ans 0 if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    } K >= 0 K 0 {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    } ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2 ans (N-1) * (K + 1) + (N - 2) * (N - 1) / 2 (N-1) * (K + 1) (N-1) N 1 (K + 1) K 1 (N - 2) * (N - 1) / 2 (N - 2) * (N - 1) (N - 2) N 2 (N - 1) N 1 2 if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    } K < 0 && N > Math.abs(K) K < 0 K 0 N > Math.abs(K) N Math.abs(K) Math.abs Math K {
    	ans = N * K + (N - 1) * N / 2;
    } ans = N * K + (N - 1) * N / 2 ans N * K + (N - 1) * N / 2 N * K N K (N - 1) * N / 2 (N - 1) * N (N - 1) N 1 N 2 if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    } K < 0 && N <= Math.abs(K) K < 0 K 0 N <= Math.abs(K) N Math.abs(K) Math.abs Math K {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    } ans = (N-1) * K + (N - 2) * (N - 1) / 2 ans (N-1) * K + (N - 2) * (N - 1) / 2 (N-1) * K (N-1) N 1 K (N - 2) * (N - 1) / 2 (N - 2) * (N - 1) (N - 2) N 2 (N - 1) N 1 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int K = Integer.parseInt(sc.next());
    int ans = 0;

    if(K >= 0) {
    	ans = (N-1) * (K + 1) + (N - 2) * (N - 1) / 2;
    }
    else if( K < 0 && N > Math.abs(K)) {
    	ans = N * K + (N - 1) * N / 2;
    }
    else if(K < 0 && N <= Math.abs(K)) {
    	ans = (N-1) * K + (N - 2) * (N - 1) / 2;
    }

    System.out.println(ans);
  }
}