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

count = 0

for x in range(k+1):

    for y in range(k+1):

        if 0<=s-x-y<=k:

            count+=1

print(count)

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

count = 0

for x in range(min(s+1,k+1)):

    for y in range(min(s+1-x,k+1)):

        if 0<=s-x-y<=k:

            count+=1

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

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

-for x in range(k + 1): -    for y in range(k + 1): +for x in range(min(s + 1, k + 1)): +    for y in range(min(s + 1 - x, k + 1)):