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

cnt=0

for x in range(k+1):

    for y in range(k+1):

        z=s-x-y

        if 0<=z<=k:

            cnt +=1

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

cnt=0

for i in range(k+1):

    for j in range(k+1):

        if 0<=(s-i-j)<=k:cnt +=1

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

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

-for x in range(k + 1): -    for y in range(k + 1): -        z = s - x - y -        if 0 <= z <= k: +for i in range(k + 1): +    for j in range(k + 1): +        if 0 <= (s - i - j) <= k: