
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) Integer output = 0; output 0 Integer kInteger = new Integer(scanner.next()); kInteger new Integer(scanner.next()) Integer sInteger = new Integer(scanner.next()); sInteger new Integer(scanner.next()) for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		} int x = 0; int x = 0; x 0 x<=kInteger x kInteger x++ x++ x {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		} {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		} for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			} int y = 0; int y = 0; y 0 y<=kInteger y kInteger y++ y++ y {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			} {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			} if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++; kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y) kInteger>=(sInteger - x-y) kInteger (sInteger - x-y) sInteger - x-y sInteger x y 0<=(sInteger - x-y) 0 (sInteger - x-y) sInteger - x-y sInteger x y output++ output System.out.println(output) System.out.println System.out System System.out output scanner.close() scanner.close scanner String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer output = 0;

		Integer kInteger = new Integer(scanner.next());
		Integer sInteger = new Integer(scanner.next());

		for(int x = 0;x<=kInteger;x++) {
			for(int y = 0;y<=kInteger;y++) {
			if(kInteger>=(sInteger - x-y) && 0<=(sInteger - x-y))
				output++;
			}
		}
		System.out.println(output);
		scanner.close();
	}
}
