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



count = 0

for x in range(k + 1):

  for y in range(k + 1):

    z = s - x - y

    if z >= 0 and z <= k:

      count += 1



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



ans = 0

for x in range(k+1):

  for y in range(k+1):

    z = s - x - y

    if x+y+z != s:

      continue

    if z >= 0 and z <= k:

      ans += 1

      

      

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

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

-count = 0 +ans = 0 +        if x + y + z != s: +            continue -            count += 1 -print(count) +            ans += 1 +print(ans)