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

ans = 0

for i in range(K+1):

    for j in range(K+1):

        z = S-i-j

        if 0<=z<=K:

            ans += 1

print(ans)

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

ans = 0

for i in range(K+1):

    for j in range(K+1):

        if 0<=S-i-j<=K:

            ans += 1

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

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

-        z = S - i - j -        if 0 <= z <= K: +        if 0 <= S - i - j <= K: