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

ans = 0



for k in range(K+1):

    for j in range(S-k+1):

        if j <= K and 0 <= S-k-j <= K:

            ans += 1

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

ans = 0

for X in range(K+1):

    for Y in range(K+1):

        if 0 <= S-(X+Y) <= K:

            ans += 1

print(ans)

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

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

-for k in range(K + 1): -    for j in range(S - k + 1): -        if j <= K and 0 <= S - k - j <= K: +for X in range(K + 1): +    for Y in range(K + 1): +        if 0 <= S - (X + Y) <= K: