import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;

public class Main
{
    int k, s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Map; Map java.util import java.util.HashMap; HashMap java.util public class Main
{
    int k, s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} Main int k k s; s public static void main(String args[])
    {
	new Main().solve();
    } main {
	new Main().solve();
    } new Main().solve() new Main().solve new Main() String args[] args void solve()
    {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    } solve {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    } in() in int cnt = 0; cnt 0 for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	} int i = 0; int i = 0; i 0 i <= k i k i++ i++ i {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	} {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	} for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    } int j = 0; int j = 0; j 0 j <= k j k j++ j++ j {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    } {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    } int n = s - i - j; n s - i - j s - i - j s i j if(n >= 0 && n <= k) cnt++; n >= 0 && n <= k n >= 0 n 0 n <= k n k cnt++ cnt out(cnt) out cnt void in()
    {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    } in {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) k = sc.nextInt() k sc.nextInt() sc.nextInt sc s = sc.nextInt() s sc.nextInt() sc.nextInt sc void out()
    {
	
    } out {
	
    } void out(int n)
    {
	System.out.println(n);
    } out {
	System.out.println(n);
    } System.out.println(n) System.out.println System.out System System.out n int n n void out(char c)
    {
	System.out.print(c);
    } out {
	System.out.print(c);
    } System.out.print(c) System.out.print System.out System System.out c char c c void out(String s)
    {
	System.out.println(s);
    } out {
	System.out.println(s);
    } System.out.println(s) System.out.println System.out System System.out s String s s public class Main
{
    int k, s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} public class Main
{
    int k, s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;

public class Main
{
    int k, s;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	int cnt = 0;
	
	for(int i = 0; i <= k; i++) {
	    for(int j = 0; j <= k; j++) {
		int n = s - i - j;
		if(n >= 0 && n <= k) cnt++;
	    }
	}
	
	out(cnt);
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	k = sc.nextInt();
	s = sc.nextInt();
    }

    void out()
    {
	
    }
    
    void out(int n)
    {
	System.out.println(n);
    }

    void out(char c)
    {
	System.out.print(c);
    }
    
    void out(String s)
    {
	System.out.println(s);
    }
}
