import java.util.*;

public class Main{
  public static void main(String[] args){
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  }
} Main public static void main(String[] args){
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  } main {
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int K = scanner.nextInt(); K scanner.nextInt() scanner.nextInt scanner int S = scanner.nextInt(); S scanner.nextInt() scanner.nextInt scanner int Z = K; Z K int counter = 0; counter 0 while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    } Z>=0 Z 0 {
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    } int Y = S-Z; Y S-Z S Z if(Y>K){
        Y=K;
      } Y>K Y K {
        Y=K;
      } Y=K Y K while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      } Y>=0 Y 0 {
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      } int X = S-Z-Y; X S-Z-Y S-Z-Y S Z Y if(K>=X && X>=0){
          counter++;
        } K>=X && X>=0 K>=X K X X>=0 X 0 {
          counter++;
        } counter++ counter Y-- Y Z-- Z System.out.println(counter) System.out.println System.out System System.out counter String[] args args public class Main{
  public static void main(String[] args){
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  }
} public class Main{
  public static void main(String[] args){
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
  	Scanner scanner = new Scanner(System.in);
  	int K = scanner.nextInt();
  	int S = scanner.nextInt();
    
    int Z = K;
    int counter = 0;
    while(Z>=0){
      int Y = S-Z;
      if(Y>K){
        Y=K;
      }
      while(Y>=0){
        int X = S-Z-Y;
        if(K>=X && X>=0){
          counter++;
        }
        Y--;
      }
      Z--;
    }
  
  	System.out.println(counter);
  }
}