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



count= 0



for i in range(K+1):# X

  for j in range(K+1):#Y

    Z = S - i - j

    if 0 <= Z <= K:

      count += 1

      #print(i,j,Z)

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

ans = 0

for i in range(K + 1):

  for j in range(K + 1):

    #print(i, j)

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

      ans += 1

      

      

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

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

-count = 0 -for i in range(K + 1):  # X -    for j in range(K + 1):  # Y -        Z = S - i - j -        if 0 <= Z <= K: -            count += 1 -            # print(i,j,Z) -print(count) +ans = 0 +for i in range(K + 1): +    for j in range(K + 1): +        # print(i, j) +        if 0 <= S - i - j <= K: +            ans += 1 +print(ans)