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 z < 0:

            break

        if z <= 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 0 <= z <= 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 z < 0:
            break
        if z <= 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 0 <= z <= k:
            count += 1
print(count)

-        if z < 0: -            break -        if z <= k: +        if 0 <= z <= k: