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



counter = 0

for x in range(k+1):

    for y in range(k+1):

            if (s- (x + y) <= k) and (s - (x+ y) >= 0):

                counter += 1





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



count = 0

for i in range(k+1):

  for j in range(k+1):

    if 0 <= s-i-j <=k:

      count+=1



print(count)

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

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

-counter = 0 -for x in range(k + 1): -    for y in range(k + 1): -        if (s - (x + y) <= k) and (s - (x + y) >= 0): -            counter += 1 -print(counter) +count = 0 +for i in range(k + 1): +    for j in range(k + 1): +        if 0 <= s - i - j <= k: +            count += 1 +print(count)