l=list(map(int, input().split()))

K, S = l[0], l[1]



count=0

for X in range(0, K+1):

    for Y in range(0, K+1):

        if S-(X+Y)>=0 and S-(X+Y)<=K:

            count += 1

print(count)

K, S=list(map(int, input().split()))



count=0

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

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

        z = S-(x+y)

        if 0<= z and z<=K:

            count += 1

print(count)

l = list(map(int, input().split()))
K, S = l[0], l[1]
count = 0
for X in range(0, K + 1):
    for Y in range(0, K + 1):
        if S - (X + Y) >= 0 and S - (X + Y) <= K:
            count += 1
print(count)

K, S = list(map(int, input().split()))
count = 0
for x in range(0, K + 1):
    for y in range(0, K + 1):
        z = S - (x + y)
        if 0 <= z and z <= K:
            count += 1
print(count)

-l = list(map(int, input().split())) -K, S = l[0], l[1] +K, S = list(map(int, input().split())) -for X in range(0, K + 1): -    for Y in range(0, K + 1): -        if S - (X + Y) >= 0 and S - (X + Y) <= K: +for x in range(0, K + 1): +    for y in range(0, K + 1): +        z = S - (x + y) +        if 0 <= z and z <= K: