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



ans = 0

for i in range(k + 1):

  for j in range(k + 1):

    if i + j == s: ans += 1

    elif 0 <= s - (i + j) <= k:

      ans += 1



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

ans = 0

for x in range(k+1):

  for y in range(k+1):

    if x + y > s: break

    if s - x - y <= k: ans += 1

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

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

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