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

a = 0



for X in range(K+1):

  for Y in range(K+1):

    Z = S-X-Y

    if 0<=Z<=K:

      a+=1



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

a = 0



for X in range(K+1):

  for Y in range(K+1):

    if 0<=S-X-Y<=K:

      a+=1



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

K, S = list(map(int, input().split()))
a = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if 0 <= S - X - Y <= K:
            a += 1
print(a)

-        Z = S - X - Y -        if 0 <= Z <= K: +        if 0 <= S - X - Y <= K: