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

crt=0

for x in range(K+1):

  for y in range(K+1):

    if S-K<=x+y<=S:

      crt+=1

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

crt=0

for x in range(0,K+1):

  for y in range(0,K+1):

    z=S-x-y

    if 0<=z<=K:

      crt+=1

print(crt)
K, S = list(map(int, input().split()))
crt = 0
for x in range(K + 1):
    for y in range(K + 1):
        if S - K <= x + y <= S:
            crt += 1
print(crt)

K, S = list(map(int, input().split()))
crt = 0
for x in range(0, K + 1):
    for y in range(0, K + 1):
        z = S - x - y
        if 0 <= z <= K:
            crt += 1
print(crt)

-for x in range(K + 1): -    for y in range(K + 1): -        if S - K <= x + y <= S: +for x in range(0, K + 1): +    for y in range(0, K + 1): +        z = S - x - y +        if 0 <= z <= K: