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

ans=0



for i in range(0,k+1):

    for j in range(0,k+1):

        x=i

        y=j

        z=s-i-j

        if 0<=z<=k:

            ans+=1

        else:

            ans+=0







print(ans)

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

ans=0

for i in range(k+1):

    for j in range(k+1):

        z=s-i-j

        if k>=z>=0:

            ans+=1

            #print(i,j,z)

print(ans)

k, s = list(map(int, input().split()))
ans = 0
for i in range(0, k + 1):
    for j in range(0, k + 1):
        x = i
        y = j
        z = s - i - j
        if 0 <= z <= k:
            ans += 1
        else:
            ans += 0
print(ans)

k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
    for j in range(k + 1):
        z = s - i - j
        if k >= z >= 0:
            ans += 1
            # print(i,j,z)
print(ans)

-for i in range(0, k + 1): -    for j in range(0, k + 1): -        x = i -        y = j +for i in range(k + 1): +    for j in range(k + 1): -        if 0 <= z <= k: +        if k >= z >= 0: -        else: -            ans += 0 +            # print(i,j,z)