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 or z > k:

            continue

        else:

            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):

        if 0 <= 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 0 > z or z > k:
            continue
        else:
            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):
        if 0 <= s - x - y <= k:
            count += 1
print(count)

-        z = s - x - y -        if 0 > z or z > k: -            continue -        else: +        if 0 <= s - x - y <= k: