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

 

ans = 0

for x in range(k+1):

    if x > s:

        break

    if x+k+k < s:

        continue

    for y in range(k+1):

        ans += max(0, 0<=s-x-y<=k)

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



ans = 0

for i in range(k+1):

    for j in range(k+1):

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

            ans += 1

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

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

-for x in range(k + 1): -    if x > s: -        break -    if x + k + k < s: -        continue -    for y in range(k + 1): -        ans += max(0, 0 <= s - x - y <= k) +for i in range(k + 1): +    for j in range(k + 1): +        if 0 <= s - i - j <= k: +            ans += 1