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

c=0

for i in range(k+1):

    for j in range(k+1):

        if s>=i+j and s-(i+j)<=k:

            c+=1

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



ans = 0



for x in list(range(K+1)):

    for y in list(range(K+1)):

        z = S-x-y

        if 0 <= z <= K:

            ans += 1



print(ans)
k, s = list(map(int, input().split()))
c = 0
for i in range(k + 1):
    for j in range(k + 1):
        if s >= i + j and s - (i + j) <= k:
            c += 1
print(c)

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

-k, s = list(map(int, input().split())) -c = 0 -for i in range(k + 1): -    for j in range(k + 1): -        if s >= i + j and s - (i + j) <= k: -            c += 1 -print(c) +K, S = list(map(int, input().split())) +ans = 0 +for x in list(range(K + 1)): +    for y in list(range(K + 1)): +        z = S - x - y +        if 0 <= z <= K: +            ans += 1 +print(ans)