k,s = list(map(int,input().split()))

n = 0



for x in range(k+1):

    for y in range(k+1):

        z = s-x-y

        if 0<=z<=k:

            n+=1



print(n)
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()))
n = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            n += 1
print(n)

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())) -n = 0 -for x in range(k + 1): -    for y in range(k + 1): -        z = s - x - y -        if 0 <= z <= k: -            n += 1 -print(n) +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)