import java.util.Scanner;

class Main{

	static	int[] data;




	public static void main(String[] args) {





		Scanner sc = new Scanner(System.in);			//文字の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
		
		int ans = 0;
		for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		}

		System.out.println(ans);


	}



	static void num(int n){


		int num = n;
		for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		}
		return;

	}
}


class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}

 import java.util.Scanner; Scanner java.util class Main{

	static	int[] data;




	public static void main(String[] args) {





		Scanner sc = new Scanner(System.in);			//文字の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
		
		int ans = 0;
		for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		}

		System.out.println(ans);


	}



	static void num(int n){


		int num = n;
		for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		}
		return;

	}
} Main static	int[] data; data public static void main(String[] args) {





		Scanner sc = new Scanner(System.in);			//文字の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
		
		int ans = 0;
		for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		}

		System.out.println(ans);


	} main {





		Scanner sc = new Scanner(System.in);			//文字の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
		
		int ans = 0;
		for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		}

		System.out.println(ans);


	} 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 ans = 0; ans 0 for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		} int a = 0; int a = 0; a 0 a <= k a k a++ a++ a {
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		} {
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		} for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			} int b = 0; int b = 0; b 0 b <= k b k b++ b++ b {
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			} {
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			} int c =  s - (b + a); c s - (b + a) s (b + a) b a if(c <= k && c >= 0){
					ans++;
				} c <= k && c >= 0 c <= k c k c >= 0 c 0 {
					ans++;
				} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args static void num(int n){


		int num = n;
		for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		}
		return;

	} num {


		int num = n;
		for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		}
		return;

	} int num = n; num n for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		} {
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		} if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			} n % i == 0 n % i n i 0 {
				data[i]++;
				n /= i;
				i = 1;
			} data[i]++ data[i] data i n /= i n i i = 1 i 1 return; int n n class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
} Pair Character from; from int end; end @Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} compareTo {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} Pair otherpair = (Pair)other; otherpair (Pair)other return end - otherpair.end; end - otherpair.end end otherpair.end otherpair otherpair.end Object other other Comparable
import java.util.Scanner;

class Main{

	static	int[] data;




	public static void main(String[] args) {





		Scanner sc = new Scanner(System.in);			//文字の入力
		int k = sc.nextInt();
		int s = sc.nextInt();
		
		int ans = 0;
		for(int a = 0;a <= k;a++){
			for(int b = 0;b <= k;b++){
				int c =  s - (b + a);
				if(c <= k && c >= 0){
					ans++;
				}
			}
		}

		System.out.println(ans);


	}



	static void num(int n){


		int num = n;
		for(int i = 1;i <= n;i++){
			if(n % i == 0){
				data[i]++;
				n /= i;
				i = 1;
			}
		}
		return;

	}
}


class Pair implements Comparable{
	Character from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


