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

count = 0



for i in range(K+1):

  for j in range(K+1):

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

        count += 1

print(count)

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

count = 0

for x in range(k+1):

    for y in range(k+1):

        if (k>=s-x-y>=0):

            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 S - i - j <= K and S - i - j >= 0:
            count += 1
print(count)

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

-K, S = list(map(int, input().split(" "))) +k, s = list(map(int, input().split())) -for i in range(K + 1): -    for j in range(K + 1): -        if S - i - j <= K and S - i - j >= 0: +for x in range(k + 1): +    for y in range(k + 1): +        if k >= s - x - y >= 0: