import sys

import copy

import string

from _bisect import *

from collections import *

from operator import itemgetter

from math import factorial

"""

from fractions import gcd

def lcm(x, y):

    return (x * y) // gcd(x, y)

"""

stdin = sys.stdin

ni = lambda: int(ns())

na = lambda: list(map(int, stdin.readline().split()))

ns = lambda: stdin.readline()



k, s = na()

ct = 0

for x in range(k+1):

    for y in range(k+1):

        z = s - x - y

        if 0 <= z <= k:

            ct += 1

print(ct)



















import sys



stdin = sys.stdin

ni = lambda: int(ns())

na = lambda: list(map(int, stdin.readline().split()))

ns = lambda: stdin.readline()



k, s = na()

ct = 0

for x in range(k+1):

    for y in range(k+1):

        z = s - x - y

        if 0 <= z <= k:

            ct += 1

print(ct)



















import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial

"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
k, s = na()
ct = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)

import sys

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
k, s = na()
ct = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)

-import copy -import string -from _bisect import * -from collections import * -from operator import itemgetter -from math import factorial -""" -from fractions import gcd -def lcm(x, y): -    return (x * y) // gcd(x, y) -"""