import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	} main {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		} {
			sc.close();
		} sc.close() sc.close sc {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} 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++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			} int a = 0; int a = 0; a 0 a <= k a k a++ a++ a {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			} {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			} if (a == s) {
					ans++;
					break;
				} a == s a s {
					ans++;
					break;
				} ans++ ans break; int bc  = (int) Math.ceil((double) (s - a) / 2); bc (int) Math.ceil((double) (s - a) / 2) Math.ceil Math (double) (s - a) / 2 (double) (s - a) s a 2 if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				} bc <= k bc k {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				} for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					} int b = 0; int b = 0; b 0 b <= k b k b++ b++ b {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					} {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					} if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						} s - a - b >= 0 && s - a - b <= k s - a - b >= 0 s - a - b s - a - b s a b 0 s - a - b <= k s - a - b s - a - b s a b k {
							ans++;
						} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int k = sc.nextInt();
			int s = sc.nextInt();

			int ans = 0;
			for (int a = 0; a <= k; a++) {
				if (a == s) {
					ans++;
					break;
				}
				int bc  = (int) Math.ceil((double) (s - a) / 2);
				if (bc <= k) {
					for (int b = 0; b <= k; b++) {
						if (s - a - b >= 0 && s - a - b <= k) {
							ans++;
						}
					}
				}
			}

			System.out.println(ans);

		} finally {
			sc.close();
		}
	}
}