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

ans = 0

for i in range(K+1):

    tmp = S - i

    if tmp >= 0:

        for j in range(K+1):

            if (S - i - j) >= 0 and (S - i -j) <= K:

                ans += 1

print(ans)
K, S = tmp = 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):
    tmp = S - i
    if tmp >= 0:
        for j in range(K + 1):
            if (S - i - j) >= 0 and (S - i - j) <= K:
                ans += 1
print(ans)

K, S = tmp = 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())) +K, S = tmp = list(map(int, input().split())) -    tmp = S - i -    if tmp >= 0: -        for j in range(K + 1): -            if (S - i - j) >= 0 and (S - i - j) <= K: -                ans += 1 +    for j in range(K + 1): +        if 0 <= S - i - j <= K: +            ans += 1