import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    } main {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int k = scan.nextInt(); k scan.nextInt() scan.nextInt scan int s = scan.nextInt(); s scan.nextInt() scan.nextInt scan int count = 0; count 0 for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        } int x = 0; int x = 0; x 0 x <=  s x s x++ x++ x {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        } {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        } if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            } x <= k x k {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            } for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                } int y = 0; int y = 0; y 0 y <= s - x y s - x s x y++ y++ y {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                } {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                } if (y <= k && s - x - y <= k){
                        count += 1;
                    } y <= k && s - x - y <= k y <= k y k s - x - y <= k s - x - y s - x - y s x y k {
                        count += 1;
                    } count += 1 count 1 System.out.println(String.valueOf(count)) System.out.println System.out System System.out String.valueOf(count) String.valueOf String count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = scan.nextInt();
        int s = scan.nextInt();

        int count = 0;

        for(int x = 0; x <=  s; x++) {
            if(x <= k) {
                for(int y = 0; y <= s - x; y++) {
                    if (y <= k && s - x - y <= k){
                        count += 1;
                    }
                }
            }
        }
        System.out.println(String.valueOf(count));

    }
}