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

count=0

for i in range(k+1):

    for j in range(k+1):

        t = s-i-j

        if t <= k and t >= 0:

            count += 1

        else:

            pass

print (count)

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

count=0

for i in range(k+1):

    for j in range(k+1):

        t = s-i-j

        if t <= k and t >= 0:

            count += 1

print (count)

k, s = list(map(int, input().split()))
count = 0
for i in range(k + 1):
    for j in range(k + 1):
        t = s - i - j
        if t <= k and t >= 0:
            count += 1
        else:
            pass
print(count)

k, s = list(map(int, input().split()))
count = 0
for i in range(k + 1):
    for j in range(k + 1):
        t = s - i - j
        if t <= k and t >= 0:
            count += 1
print(count)

-        else: -            pass