
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    }
} Main public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 s x y if (0 <= z && z <= k) {
                    count++;
                } 0 <= z && z <= k 0 <= z 0 z z <= k z k {
                    count++;
                } count++ count System.out.println(count) System.out.println System.out System System.out count bw.flush() bw.flush bw String[] args args public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    }
} public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    }
} Main

import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        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++;
                }
            }
        }
        System.out.println(count);
        bw.flush();
    }
}
