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



ans = 0

for x in range(s + 1):

  for y in range(s - x + 1):

    z = s - x - y

    

    if x <= k and y <= k and z <= 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):

        z = (s-(x+y))

        if 0 <= z and z <= k:

            ans += 1 



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

-for x in range(s + 1): -    for y in range(s - x + 1): -        z = s - x - y -        if x <= k and y <= k and z <= k: +for x in range(k + 1): +    for y in range(k + 1): +        z = s - (x + y) +        if 0 <= z and z <= k: