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

flg = 0

for x in range(k+1):

    for y in range(k+1):

        z = s-x-y

        if z>= 0 and z <= k:

                flg += 1

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

flg = 0

for x in range(k+1):

    for y in range(k+1):

        z = s-x-y

        if 0<= z <= k:

            flg += 1

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

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

-        if z >= 0 and z <= k: +        if 0 <= z <= k: