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

public class Main{
    
    public static void main(String[] args) throws IOException {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
    
    public static void main(String[] args) throws IOException {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
} Main static int MIN = Integer.MIN_VALUE; MIN Integer.MIN_VALUE Integer Integer.MIN_VALUE static int MAX = Integer.MAX_VALUE; MAX Integer.MAX_VALUE Integer Integer.MAX_VALUE static Reader in = new Reader(); in new Reader() static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) throws IOException {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    } main {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    } int K = in.nextInt(); K in.nextInt() in.nextInt in int S = in.nextInt(); S in.nextInt() in.nextInt in int ans = 0; ans 0 for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        } int X = 0; int X = 0; X 0 X <= K X K X++ X++ X {
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        } {
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        } for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            } int Y = 0; int Y = 0; Y 0 Y <= K Y K Y++ Y++ Y {
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            } {
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            } int Z = S - (X+Y); Z S - (X+Y) S (X+Y) X Y if(Z >= 0 && Z <= K){
                    ans++;        
                } Z >= 0 && Z <= K Z >= 0 Z 0 Z <= K Z K {
                    ans++;        
                } ans++ ans println(ans) println ans in.close() in.close in out.close() out.close out String[] args args static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } } read { for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } } for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } int i = 0; int i = 0; i 0 i < N i N i++ i++ i { arr[i] = in.nextInt(); } { arr[i] = in.nextInt(); } arr[i] = in.nextInt() arr[i] arr i in.nextInt() in.nextInt in int arr[] arr int N N static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } } read { for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } } for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } int i = 0; int i = 0; i 0 i < N i N i++ i++ i { arr[i] = in.nextLong(); } { arr[i] = in.nextLong(); } arr[i] = in.nextLong() arr[i] arr i in.nextLong() in.nextLong in long arr[] arr int N N static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } } read { for(int i = 0; i < N; i++){ arr[i] = in.next(); } } for(int i = 0; i < N; i++){ arr[i] = in.next(); } int i = 0; int i = 0; i 0 i < N i N i++ i++ i { arr[i] = in.next(); } { arr[i] = in.next(); } arr[i] = in.next() arr[i] arr i in.next() in.next in String arr[] arr int N N static void print(Object O){ out.print(O); } print { out.print(O); } out.print(O) out.print out O Object O O static void println(Object O){ out.println(O); } println { out.println(O); } out.println(O) out.println out O Object O O static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); } print { for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); } for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i { print(arr[i]+" "); } { print(arr[i]+" "); } print(arr[i]+" ") print arr[i]+" " arr[i] arr i " " println("") println "" int arr[] arr static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } } print { for(int i = 0; i < arr.length; i++){ print(arr[i]); } } for(int i = 0; i < arr.length; i++){ print(arr[i]); } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i { print(arr[i]); } { print(arr[i]); } print(arr[i]) print arr[i] arr i int arr[][] arr static void debug(Object O){ System.out.println(O); } debug { System.out.println(O); } System.out.println(O) System.out.println System.out System System.out O Object O O class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
} Reader BufferedReader reader; reader StringTokenizer tokenizer; tokenizer Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    } Reader {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    } reader = new BufferedReader(new InputStreamReader(System.in)) reader new BufferedReader(new InputStreamReader(System.in)) tokenizer = new StringTokenizer("") tokenizer new StringTokenizer("") String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    } next {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    } while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        } !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    } nextInt { 
        return Integer.parseInt(next()); 
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    } nextDouble { 
        return Double.parseDouble(next());
    } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    } nextLong { 
        return Long.parseLong(next()); 
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next String nextLine() throws IOException { 
        return reader.readLine(); 
    } nextLine { 
        return reader.readLine(); 
    } return reader.readLine(); reader.readLine() reader.readLine reader void close() throws IOException { 
        reader.close(); 
    } close { 
        reader.close(); 
    } reader.close() reader.close reader public class Main{
    
    public static void main(String[] args) throws IOException {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
} public class Main{
    
    public static void main(String[] args) throws IOException {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
} Main
import java.io.*;
import java.util.*;

public class Main{
    
    public static void main(String[] args) throws IOException {
        int K = in.nextInt();
        int S = in.nextInt();
        int ans = 0;
        for(int X = 0; X <= K; X++){
            for(int Y = 0; Y <= K; Y++){
                int Z = S - (X+Y);
                if(Z >= 0 && Z <= K){
                    ans++;        
                }
            }
        }
        println(ans);
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i = 0; i < N; i++){ arr[i] = in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i = 0; i < arr.length; i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i = 0; i < arr.length; i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { 
            tokenizer = new StringTokenizer(reader.readLine()); 
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { 
        return Integer.parseInt(next()); 
    }
    
    double nextDouble() throws IOException { 
        return Double.parseDouble(next());
    }
    
    long nextLong() throws IOException { 
        return Long.parseLong(next()); 
    }
    
    String nextLine() throws IOException { 
        return reader.readLine(); 
    }
    
    void close() throws IOException { 
        reader.close(); 
    }
}