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

O=0

for X in range(K+1):

  for Y in range(K+1):

    Z=S-X-Y

    if 0<=Z<=K:

      O+=1

print(O)

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

ans=0

for X in range(K+1):

    for Y in range(K+1):

        Z=S-X-Y

        if 0<=Z<=K:

            ans+=1

print(ans)

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

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

-O = 0 +ans = 0 -            O += 1 -print(O) +            ans += 1 +print(ans)