

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

wariate = 0



for x in range(0, K + 1):

    for y in range(0, K + 1):

        z = S - (x + y)

        if 0 <= z <= K:

            wariate += 1



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

cnt = 0



for x in range(K + 1):

    for y in range(K + 1):

        z = S - (x + y)

        cnt += (0 <= z <= K)



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

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

-wariate = 0 -for x in range(0, K + 1): -    for y in range(0, K + 1): +cnt = 0 +for x in range(K + 1): +    for y in range(K + 1): -        if 0 <= z <= K: -            wariate += 1 -print(wariate) +        cnt += 0 <= z <= K +print(cnt)