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

x=y=z=0

count = 0

for i in range(min(k,s)+1):

  for j in range(min(k,s)+1):

    z = s-x-y

    if 0 <= z <= k:

      count += 1

    y += 1

  y = 0

  x +=1

print(count)

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 0 <= z <= k:

      count += 1

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

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 0 <= z <= k:
            count += 1
print(count)

-x = y = z = 0 -for i in range(min(k, s) + 1): -    for j in range(min(k, s) + 1): +for x in range(k + 1): +    for y in range(k + 1): -        y += 1 -    y = 0 -    x += 1