import java.util.*;
import java.io.*;


public class Main{

     public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{

     public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     }
} Main public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int s =scanner.nextInt(); s scanner.nextInt() scanner.nextInt scanner int counter=0; counter 0 for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        } int i=0; int i=0; i 0 i<=n i n i++ i++ i {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        } {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        } for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            } int j=0; int j=0; j 0 j<=n j n j++ j++ j {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            } {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            } int z = s; z s z = z-i -j z z-i -j z-i -j z i j if(z>=0 && z<=n)
                counter++; z>=0 && z<=n z>=0 z 0 z<=n z n counter++ counter 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 n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     }
} public class Main{

     public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     }
} Main
import java.util.*;
import java.io.*;


public class Main{

     public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int s =scanner.nextInt();
        int counter=0;
       
        for(int i=0;i<=n;i++)
        {
            for(int j=0;j<=n;j++)
            {
                 int z = s;
                 z = z-i -j;
                if(z>=0 && z<=n)
                counter++;
            }
        }
        
        System.out.println(counter);
     }
}