import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;

public class Main {
	static ContestScanner in;
	static Writer out;
	public static void main(String[] args) {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void solve() throws IOException {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	}
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Integer>{
	@Override public Integer get(Object key){return containsKey(key)?super.get(key):0;}
	public void add(T key,int v){put(key,get(key)+v);}
	public void add(T key){put(key,get(key)+1);}
	public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
	public MultiSet<T> merge(MultiSet<T> set)
	{MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
	for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
	public Writer(String filename)throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));}
	public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
	private BufferedReader in;private int c=-2;
	public ContestScanner()throws IOException 
	{in=new BufferedReader(new InputStreamReader(System.in));}
	public ContestScanner(String filename)throws IOException
	{in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
	public String nextToken()throws IOException {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public String readLine()throws IOException{
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public long nextLong()throws IOException,NumberFormatException
	{return Long.parseLong(nextToken());}
	public int nextInt()throws NumberFormatException,IOException
	{return(int)nextLong();}
	public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());}
	public void close() throws IOException {in.close();}
} import java.io.BufferedReader; BufferedReader java.io import java.io.BufferedWriter; BufferedWriter java.io import java.io.Closeable; Closeable java.io import java.io.FileInputStream; FileInputStream java.io import java.io.FileWriter; FileWriter java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Deque; Deque java.util import java.util.HashMap; HashMap java.util import java.util.List; List java.util public class Main {
	static ContestScanner in;
	static Writer out;
	public static void main(String[] args) {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void solve() throws IOException {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	}
} Main static ContestScanner in; in static Writer out; out public static void main(String[] args) {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} main {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	} Main main = new Main(); main new Main() try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} in = new ContestScanner() in new ContestScanner() out = new Writer() out new Writer() main.solve() main.solve main out.close() out.close out in.close() in.close in String[] args args void solve() throws IOException {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	} solve {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	} int k = in.nextInt(); k in.nextInt() in.nextInt in int s = in.nextInt(); s in.nextInt() in.nextInt in long ans = 0; ans 0 for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		} int x = 0; int x = 0; x 0 x <= k x k x++ x++ x {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		} {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		} for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			} int y = 0; int y = 0; y 0 y <= k y k y++ y++ y {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			} {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			} int z = s - (x + y); z s - (x + y) s (x + y) x y if(z < 0 || k < z) continue; z < 0 || k < z z < 0 z 0 k < z k z continue; ans++ ans System.out.println(ans) System.out.println System.out System System.out ans class MultiSet<T> extends HashMap<T, Integer>{
	@Override public Integer get(Object key){return containsKey(key)?super.get(key):0;}
	public void add(T key,int v){put(key,get(key)+v);}
	public void add(T key){put(key,get(key)+1);}
	public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
	public MultiSet<T> merge(MultiSet<T> set)
	{MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
	for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
} MultiSet @Override public Integer get(Object key){return containsKey(key)?super.get(key):0;} get {return containsKey(key)?super.get(key):0;} return containsKey(key)?super.get(key):0; containsKey(key)?super.get(key):0 containsKey(key) containsKey key super.get(key) super.get super key 0 Object key key public void add(T key,int v){put(key,get(key)+v);} add {put(key,get(key)+v);} put(key,get(key)+v) put key get(key)+v get(key) get key v T key key int v v public void add(T key){put(key,get(key)+1);} add {put(key,get(key)+1);} put(key,get(key)+1) put key get(key)+1 get(key) get key 1 T key key public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);} sub {final int v=get(key);if(v==1)remove(key);else put(key,v-1);} final int v=get(key); v get(key) get key if(v==1)remove(key);else put(key,v-1); v==1 v 1 remove(key) remove key put(key,v-1) put key v-1 v 1 T key key public MultiSet<T> merge(MultiSet<T> set)
	{MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
	for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;} merge {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
	for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;} MultiSet<T>s s l; l if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;} this.size()<set.size() this.size() this.size this set.size() set.size set {s=this;l=set;} s=this s this l=set l set {s=set;l=this;} s=set s set l=this l this for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue()); Entry<T,Integer>e s.entrySet() s.entrySet s l.add(e.getKey(),e.getValue()); l.add(e.getKey(),e.getValue()) l.add l e.getKey() e.getKey e e.getValue() e.getValue e return l; l MultiSet<T> set set HashMap class Writer extends PrintWriter{
	public Writer(String filename)throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));}
	public Writer()throws IOException{super(System.out);}
} Writer public Writer(String filename)throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));} Writer {super(new BufferedWriter(new FileWriter(filename)));} super(new BufferedWriter(new FileWriter(filename))) super new BufferedWriter(new FileWriter(filename)) String filename filename public Writer()throws IOException{super(System.out);} Writer {super(System.out);} super(System.out) super System.out System System.out PrintWriter class ContestScanner implements Closeable{
	private BufferedReader in;private int c=-2;
	public ContestScanner()throws IOException 
	{in=new BufferedReader(new InputStreamReader(System.in));}
	public ContestScanner(String filename)throws IOException
	{in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
	public String nextToken()throws IOException {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public String readLine()throws IOException{
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public long nextLong()throws IOException,NumberFormatException
	{return Long.parseLong(nextToken());}
	public int nextInt()throws NumberFormatException,IOException
	{return(int)nextLong();}
	public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());}
	public void close() throws IOException {in.close();}
} ContestScanner private BufferedReader in; in private int c=-2; c -2 2 public ContestScanner()throws IOException 
	{in=new BufferedReader(new InputStreamReader(System.in));} ContestScanner {in=new BufferedReader(new InputStreamReader(System.in));} in=new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) public ContestScanner(String filename)throws IOException
	{in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));} ContestScanner {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));} in=new BufferedReader(new InputStreamReader(new FileInputStream(filename))) in new BufferedReader(new InputStreamReader(new FileInputStream(filename))) String filename filename public String nextToken()throws IOException {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	} nextToken {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	} StringBuilder sb=new StringBuilder(); sb new StringBuilder() while((c=in.read())!=-1&&Character.isWhitespace(c)); (c=in.read())!=-1&&Character.isWhitespace(c) (c=in.read())!=-1 (c=in.read()) c in.read() in.read in -1 1 Character.isWhitespace(c) Character.isWhitespace Character c while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();} c!=-1&&!Character.isWhitespace(c) c!=-1 c -1 1 !Character.isWhitespace(c) Character.isWhitespace(c) Character.isWhitespace Character c {sb.append((char)c);c=in.read();} sb.append((char)c) sb.append sb (char)c c=in.read() c in.read() in.read in return sb.toString(); sb.toString() sb.toString sb public String readLine()throws IOException{
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	} readLine {
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	} StringBuilder sb=new StringBuilder(); sb new StringBuilder() if(c==-2)c=in.read(); c==-2 c -2 2 c=in.read() c in.read() in.read in while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();} c!=-1&&c!='\n'&&c!='\r' c!=-1&&c!='\n'&&c!='\r' c!=-1 c -1 1 c!='\n' c '\n' c!='\r' c '\r' {sb.append((char)c);c=in.read();} sb.append((char)c) sb.append sb (char)c c=in.read() c in.read() in.read in return sb.toString(); sb.toString() sb.toString sb public long nextLong()throws IOException,NumberFormatException
	{return Long.parseLong(nextToken());} nextLong {return Long.parseLong(nextToken());} return Long.parseLong(nextToken()); Long.parseLong(nextToken()) Long.parseLong Long nextToken() nextToken public int nextInt()throws NumberFormatException,IOException
	{return(int)nextLong();} nextInt {return(int)nextLong();} return(int)nextLong(); (int)nextLong() nextLong public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());} nextDouble {return Double.parseDouble(nextToken());} return Double.parseDouble(nextToken()); Double.parseDouble(nextToken()) Double.parseDouble Double nextToken() nextToken public void close() throws IOException {in.close();} close {in.close();} in.close() in.close in Closeable public class Main {
	static ContestScanner in;
	static Writer out;
	public static void main(String[] args) {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void solve() throws IOException {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	static ContestScanner in;
	static Writer out;
	public static void main(String[] args) {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void solve() throws IOException {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	}
} Main
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;

public class Main {
	static ContestScanner in;
	static Writer out;
	public static void main(String[] args) {
		Main main = new Main();
		try {
			in = new ContestScanner();
			out = new Writer();
			main.solve();
			out.close();
			in.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void solve() throws IOException {
		int k = in.nextInt();
		int s = in.nextInt();
		long ans = 0;
		for(int x = 0; x <= k; x++) {
			for(int y = 0; y <= k; y++) {
				int z = s - (x + y);
				if(z < 0 || k < z) continue;
				ans++;
			}
		}
		System.out.println(ans);
	}
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Integer>{
	@Override public Integer get(Object key){return containsKey(key)?super.get(key):0;}
	public void add(T key,int v){put(key,get(key)+v);}
	public void add(T key){put(key,get(key)+1);}
	public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
	public MultiSet<T> merge(MultiSet<T> set)
	{MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
	for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
	public Writer(String filename)throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));}
	public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
	private BufferedReader in;private int c=-2;
	public ContestScanner()throws IOException 
	{in=new BufferedReader(new InputStreamReader(System.in));}
	public ContestScanner(String filename)throws IOException
	{in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
	public String nextToken()throws IOException {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public String readLine()throws IOException{
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public long nextLong()throws IOException,NumberFormatException
	{return Long.parseLong(nextToken());}
	public int nextInt()throws NumberFormatException,IOException
	{return(int)nextLong();}
	public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());}
	public void close() throws IOException {in.close();}
}