import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

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

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} Main static void solve() {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	} solve {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int K = sc.nextInt() K sc.nextInt() sc.nextInt sc s = sc.nextInt() s sc.nextInt() sc.nextInt sc t=0; t 0 Map<Integer, Integer> m = new HashMap<Integer, Integer>(); m new HashMap<Integer, Integer>() for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		} int i=0; int i=0; i 0 i<=K i K i++ i++ i {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		} {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		} for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			} int j=0; int j=0; j 0 j<=K j K j++ j++ j {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			} {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			} m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1) m.put m i+j i j m.get(i+j)==null ? 1 : m.get(i+j)+1 m.get(i+j)==null m.get(i+j) m.get m i+j i j null 1 m.get(i+j)+1 m.get(i+j) m.get m i+j i j 1 for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k); int k=0; int k=0; k 0 k<=K k K k++ k++ k if (m.containsKey(s-k)) t+=m.get(s-k); if (m.containsKey(s-k)) t+=m.get(s-k); m.containsKey(s-k) m.containsKey m s-k s k t+=m.get(s-k) t m.get(s-k) m.get m s-k s k System.out.println(t) System.out.println System.out System System.out t sc.close() sc.close sc public static void main(String args[]) {
		solve();
	} main {
		solve();
	} solve() solve String args[] args public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} Main
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt(), s = sc.nextInt(), t=0;
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		for (int i=0; i<=K; i++) {
			for (int j=0; j<=K; j++) {
				m.put(i+j, m.get(i+j)==null ? 1 : m.get(i+j)+1);
			}
		}
		for (int k=0; k<=K; k++) if (m.containsKey(s-k)) t+=m.get(s-k);
		System.out.println(t);
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}