import itertools

k,s = [int(x) for x in input().split()]



ans = 0

for i in range(k+1):

    for j in range(k+1):

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

            ans += 1



print(ans)
k,s = [int(x) for x in input().split()]



ans = 0

for x in range(k+1):

    for y in range(k+1):

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

            ans += 1

print(ans)
import itertools

k, s = [int(x) for x in input().split()]
ans = 0
for i in range(k + 1):
    for j in range(k + 1):
        if s - i - j >= 0 and s - i - j <= k:
            ans += 1
print(ans)

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

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