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

m=0

for x in range(k+1):

    for y in range(k+1):

        z=s-x-y

        if z>=0 and z<=k:

            m+=1



print(m)

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

ans=0

for x in range(k+1):

    for y in range(k+1):

        z=s-x-y

        if z<0:

            break

        if 0<=z<=k:

            ans+=1

print(ans)

k, s = list(map(int, input().split()))
m = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if z >= 0 and z <= k:
            m += 1
print(m)

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

-m = 0 +ans = 0 -        if z >= 0 and z <= k: -            m += 1 -print(m) +        if z < 0: +            break +        if 0 <= z <= k: +            ans += 1 +print(ans)