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



answer = 0

for i in range(K+1):

  for j in range(K+1):

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

      answer += 1



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



answer = 0

for i in range(K+1):

  for j in range(K+1):

    if 0 <= S - (i + j) <= K:

      answer += 1



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

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

-        if S - (i + j) >= 0 and S - (i + j) <= K: +        if 0 <= S - (i + j) <= K: -print((str(answer))) +print(answer)