import java.util.*;


public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  }
} Main public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  } main {
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int total = 0; total 0 List<Integer> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < K+1; i++){
      list.add(i);
    } int i = 0; int i = 0; i 0 i < K+1 i K+1 K 1 i++ i++ i {
      list.add(i);
    } {
      list.add(i);
    } list.add(i) list.add list i for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    } int x = 0; int x = 0; x 0 x < K+1 x K+1 K 1 x++ x++ x {
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    } {
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    } for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      } int y = 0; int y = 0; y 0 y < K+1 y K+1 K 1 y++ y++ y {
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      } {
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      } if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          } S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0) S-(list.get(x) + list.get(y))<=K S-(list.get(x) + list.get(y)) S (list.get(x) + list.get(y)) list.get(x) list.get list x list.get(y) list.get list y K (S-(list.get(x) + list.get(y))>=0) S-(list.get(x) + list.get(y)) S (list.get(x) + list.get(y)) list.get(x) list.get list x list.get(y) list.get list y 0 {
            total += 1;
          } total += 1 total 1 System.out.println(total) System.out.println System.out System System.out total String[] arg arg public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  }
} public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  }
} Main
import java.util.*;


public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int S = sc.nextInt();
    int total = 0;
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < K+1; i++){
      list.add(i);
    }
    for(int x = 0; x < K+1; x++){
      for(int y = 0; y < K+1; y++){
          if(S-(list.get(x) + list.get(y))<=K &&
             (S-(list.get(x) + list.get(y))>=0)){
            total += 1;
          }
      }
    }
    System.out.println(total);
  }
}
