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



cnt = 0

for i in range(K+1):

  for j in range(K+1):

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

      cnt += 1

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

cnt = 0

for i in range(K+1):

  for j in range(K+1):

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

      cnt += 1

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

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

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