import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	}

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

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	} main {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int k = s.nextInt(); k s.nextInt() s.nextInt s int l = s.nextInt(); l s.nextInt() s.nextInt s int i = 0; i 0 int j = 0; j 0 int m = 15; m 15 int count = 0; count 0 int ans = 0; ans 0 int q = 0; q 0 for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		} i = 0; i = 0 i 0 i <= k i k i++ i++ i {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		} {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		} for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			} j = 0; j = 0 j 0 j <= k j k j++ j++ j {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			} {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			} q = i + j q i + j i j m = l-q m l-q l q if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				} m>=0&&0<=i&&i<=k&&j<=k&&m<=k j<=k i<=k m>=0&&0<=i&&i<=k&&j<=k&&m<=k m>=0 m 0 0<=i 0 i i<=k i k j<=k j k m<=k m k {

					count++;
				} count++ count {

				} j=0 j 0 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int k = s.nextInt();
		int l = s.nextInt();
		int i = 0;
		int j = 0;
		int m = 15;
		int count = 0;

		int ans = 0;
		int q = 0;

		for (i = 0; i <= k; i++) {
			for (j = 0; j <= k; j++) {

				q = i + j;
				m = l-q;
				if(m>=0&&0<=i&&i<=k&&j<=k&&m<=k) {

					count++;
				}else {

				}
			}
			j=0;
		}
		System.out.println(count);
	}

}