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

count = 0

for x in range(K + 1):

    for y in range(K + 1):

        z = S - (x + y)

        if 0 <= z <= K:

            if x <= S or y <= S:

                count += 1

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

count = 0

for x in range(K + 1):

    yz = S - x

    if yz < 0:

        break

    elif yz <= K:

        count += yz + 1

    elif yz <= 2*K:

        count += K - (yz-K) + 1

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

K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
    yz = S - x
    if yz < 0:
        break
    elif yz <= K:
        count += yz + 1
    elif yz <= 2 * K:
        count += K - (yz - K) + 1
print(count)

-    for y in range(K + 1): -        z = S - (x + y) -        if 0 <= z <= K: -            if x <= S or y <= S: -                count += 1 +    yz = S - x +    if yz < 0: +        break +    elif yz <= K: +        count += yz + 1 +    elif yz <= 2 * K: +        count += K - (yz - K) + 1