import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	} 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 i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		} int i = 0; int i = 0; i 0 i <= k i k i++ i++ i {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		} {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		} for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			} int t = 0; int t = 0; t 0 t <= k t k t++ t++ t {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			} {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			} int z = s - i - t; z s - i - t s - i - t s i t 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 String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		for (int i = 0; i <= k; i++) {
			for (int t = 0; t <= k; t++) {
				int z = s - i - t;
				if(0 <= z && z <= k) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}