K, S = list(map(int, input().split()))

count = 0



for i in range(K+1):

  for j in range(K+1):

    k = S - i - j

    if 0 <= k <= K:

      count += 1

        

print(count)

K, S = list(map(int, input().split()))

count = 0



for i in range(K+1):

    for j in range(K+1):

        if 0 <= S - i - j <= K:

            count += 1



print(count)

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

K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
    for j in range(K + 1):
        if 0 <= S - i - j <= K:
            count += 1
print(count)

-        k = S - i - j -        if 0 <= k <= K: +        if 0 <= S - i - j <= K: