import java.util.Scanner;

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

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    }

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

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    }

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

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    } main {
        Scanner in = new Scanner(System.in);
        int k = in.nextInt();
        int s = in.nextInt();

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int k = in.nextInt(); k in.nextInt() in.nextInt in int s = in.nextInt(); s in.nextInt() in.nextInt in int count = 0; count 0 for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        } int i = 0; int i = 0; i 0 i <= k i k i++ i++ i {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        } {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        } int diff = s - i; diff s - i s i for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            } int j = 0; int j = 0; j 0 j <= k j k j++ j++ j {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            } {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            } int diff2 = diff - j; diff2 diff - j diff j if (diff2 >= 0 && diff2 <= k) {
                    count++;
                } diff2 >= 0 && diff2 <= k diff2 >= 0 diff2 0 diff2 <= k diff2 k {
                    count++;
                } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int k = in.nextInt();
        int s = in.nextInt();

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    }

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

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    }

} Main
import java.util.Scanner;

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

        int count = 0;
        for (int i = 0; i <= k; i++) {
            int diff = s - i;
            for (int j = 0; j <= k; j++) {
                int diff2 = diff - j;
                if (diff2 >= 0 && diff2 <= k) {
                    count++;
                }
//                for (int l = 0; l <= k; l++) {
//                    if (diff2 - l == 0) {
//                        count++;
//                    }
//                }
            }
        }
        System.out.println(count);
    }

}
