import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    private static final PrintStream so = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    }
} import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
    private static final PrintStream so = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    }
} Main private static final PrintStream so = System.out; so System.out System System.out private static final Scanner     sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    } main {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    } int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        } 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 (0 <= z && z <= K) {
                    count++;
                }
            }
        } {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        } for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            } int y = 0; int y = 0; y 0 y <= K y K y++ y++ y {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            } {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            } int z = S - (x+y); z S - (x+y) S (x+y) x y if (0 <= z && z <= K) {
                    count++;
                } 0 <= z && z <= K 0 <= z 0 z z <= K z K {
                    count++;
                } count++ count so.println(count) so.println so count String[] args args public class Main {
    private static final PrintStream so = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    }
} public class Main {
    private static final PrintStream so = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    }
} Main
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    private static final PrintStream so = System.out;
    private static final Scanner     sc = new Scanner(System.in);

    public static void main(String[] args) {
        int K = sc.nextInt();
        int S = sc.nextInt();
        
        int count = 0;
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                int z = S - (x+y);
                if (0 <= z && z <= K) {
                    count++;
                }
            }
        }
        so.println(count);
    }
}
