
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    }
} Main private static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args) {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    } main {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    } int K = Integer.parseInt(scan.next()); K Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int S = Integer.parseInt(scan.next()); S Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int count = 0; count 0 for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	} int i = 0; int i = 0; i 0 i <= K i K i++ i++ i {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	} {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	} int XY = S - i; XY S - i S i if(XY < 0) break; XY < 0 XY 0 break; if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    } XY <= 2 * K XY 2 * K 2 K {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    } for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		} int j = 0; int j = 0; j 0 j <= K j K j++ j++ j {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		} {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		} int X = XY - j; X XY - j XY j if(X < 0) break; X < 0 X 0 break; if(X <= K) count++; X <= K X K count++ count System.out.println(count) System.out.println System.out System System.out count scan.close() scan.close scan String[] args args public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    }
} public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    }
} Main

import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int K = Integer.parseInt(scan.next());
	int S = Integer.parseInt(scan.next());

	int count = 0;
	for (int i = 0; i <= K; i++) {
	    int XY = S - i;
	    if(XY < 0) break;
	    if(XY <= 2 * K) {
		for (int j = 0; j <= K; j++) {
		    int X = XY - j;
		    if(X < 0) break;
		    if(X <= K) count++;
		}
	    }
	}

	System.out.println(count);
	scan.close();
    }
}
