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

ans = []

for x in range(k+1):

    for y in range(k+1):

        z = s-(x+y)

        if 0 <= z <= k:

            ans.append(0)

print((len(ans)))
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()))
ans = []
for x in range(k + 1):
    for y in range(k + 1):
        z = s - (x + y)
        if 0 <= z <= k:
            ans.append(0)
print((len(ans)))

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)

-ans = [] +count = 0 -            ans.append(0) -print((len(ans))) +            count += 1 +print(count)