import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    } main {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    } BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) String[] inputs = input.readLine().split(" "); inputs input.readLine().split(" ") input.readLine().split input.readLine() input.readLine input " " int K = Integer.parseInt(inputs[0]); K Integer.parseInt(inputs[0]) Integer.parseInt Integer inputs[0] inputs 0 int S = Integer.parseInt(inputs[1]); S Integer.parseInt(inputs[1]) Integer.parseInt Integer inputs[1] inputs 1 int[] xPlusY = new int[2 * K + 1]; xPlusY new int[2 * K + 1] 2 * K + 1 2 * K 2 K 1 for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        } int x = 0; int x = 0; x 0 x <= K x K x++ x++ x {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        } {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        } for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            } int y = 0; int y = 0; y 0 y <= K y K y++ y++ y {
                xPlusY[x + y] += 1;
            } {
                xPlusY[x + y] += 1;
            } xPlusY[x + y] += 1 xPlusY[x + y] xPlusY x + y x y 1 int count = 0; count 0 for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        } int z = 0; int z = 0; z 0 z <= K z K z++ z++ z {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        } {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        } int sMinusZ = S - z; sMinusZ S - z S z if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            } sMinusZ <= 2 * K && sMinusZ >= 0 sMinusZ <= 2 * K sMinusZ 2 * K 2 K sMinusZ >= 0 sMinusZ 0 {
                count += xPlusY[sMinusZ];
            } count += xPlusY[sMinusZ] count xPlusY[sMinusZ] xPlusY sMinusZ 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) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] inputs = input.readLine().split(" ");
        int K = Integer.parseInt(inputs[0]);
        int S = Integer.parseInt(inputs[1]);

        int[] xPlusY = new int[2 * K + 1];
        for (int x = 0; x <= K; x++) {
            for (int y = 0; y <= K; y++) {
                xPlusY[x + y] += 1;
            }
        }

        int count = 0;
        for (int z = 0; z <= K; z++) {
            int sMinusZ = S - z;
            
            if (sMinusZ <= 2 * K && sMinusZ >= 0) {
                count += xPlusY[sMinusZ];
            }

        }

        System.out.println(count);
    }
}
