import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	} main {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	} 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 P =0; P 0 int Q =0; Q 0 for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		} int X=0; int X=0; X 0 X<K+1 X K+1 K 1 X++ X++ X {
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		} {
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		} for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			} int Y=0; int Y=0; Y 0 Y<K+1 Y K+1 K 1 Y++ Y++ Y {
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			} {
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			} P=S-X-Y P S-X-Y S-X-Y S X Y if(0<=P && P<=K){
					Q++;
					} 0<=P && P<=K 0<=P 0 P P<=K P K {
					Q++;
					} Q++ Q System.out.println(Q) System.out.println System.out System System.out Q String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int K =sc.nextInt();
		int S =sc.nextInt();
		int P =0;
		int Q =0;
		
		for (int X=0; X<K+1; X++){
			for (int Y=0; Y<K+1; Y++){
					P=S-X-Y;
					if(0<=P && P<=K){
					Q++;
					}
			}
		}
			System.out.println(Q);
	}
}