import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count=0; count 0 int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		} int i=0; int i=0; i 0 i<=k i k i++ i++ i {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		} {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		} for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			} int w=0; int w=0; w 0 w<=k w k w++ w++ w {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			} {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			} if(s-i-w>=0 && s-i-w<=k) {
					count++;
				} s-i-w>=0 && s-i-w<=k s-i-w>=0 s-i-w s-i-w s i w 0 s-i-w<=k s-i-w s-i-w s i w k {
					count++;
				} count++ count System.out.print(count) System.out.print System.out System System.out count String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int count=0;
		int k = sc.nextInt();
		int s = sc.nextInt();
		for(int i=0;i<=k;i++) {
			for(int w=0;w<=k;w++) {
				if(s-i-w>=0 && s-i-w<=k) {
					count++;
				}
			}
		}
		System.out.print(count);
	}
}
