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

count= 0

for x in range(k+1):

    for y in range(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(k+1):

    for y in range(k+1):

        z = s - (x+y)

        if k >= z and 0 <= z:

            count += 1



print(count)
k, s = list(map(int, input().strip().split()))
count = 0
for x in range(k + 1):
    for y in range(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(k + 1):
    for y in range(k + 1):
        z = s - (x + y)
        if k >= z and 0 <= z:
            count += 1
print(count)

-k, s = list(map(int, input().strip().split())) +k, s = list(map(int, input().split())) -        if s - x - y >= 0 and s - x - y <= k: +        z = s - (x + y) +        if k >= z and 0 <= z: