k, s = list(map(int, input().split()))

l=[]

for x in range(0, k+1):

    for y in range(0, k+1):

        if s-x-y > k or s-x-y < 0:

            continue

        else:

            l.append(s-x-y)

print((len(l)))
k, s = list(map(int, input().split()))

c=0

for x in range(k+1):

    for y in range(k+1):

        z = s-x-y

        if z > k or z < 0:

            continue

        c += 1

print(c)
k, s = list(map(int, input().split()))
l = []
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if s - x - y > k or s - x - y < 0:
            continue
        else:
            l.append(s - x - y)
print((len(l)))

k, s = list(map(int, input().split()))
c = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if z > k or z < 0:
            continue
        c += 1
print(c)

-l = [] -for x in range(0, k + 1): -    for y in range(0, k + 1): -        if s - x - y > k or s - x - y < 0: +c = 0 +for x in range(k + 1): +    for y in range(k + 1): +        z = s - x - y +        if z > k or z < 0: -        else: -            l.append(s - x - y) -print((len(l))) +        c += 1 +print(c)