k, s = list(map(int, input().split()))



result = 0

for x in range(k + 1):

    for y in range(k + 1):

        z = s - x - y

        if 0 <= z <= k:

            result += 1



print(result)

k, s = list(map(int, input().split()))



result = 0

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

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

        if 0 <= s - x - y <= k:

            result += 1



print(result)

k, s = list(map(int, input().split()))
result = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            result += 1
print(result)

k, s = list(map(int, input().split()))
result = 0
for x in range(0, k + 1):
    for y in range(0, k + 1):
        if 0 <= s - x - y <= k:
            result += 1
print(result)

-for x in range(k + 1): -    for y in range(k + 1): -        z = s - x - y -        if 0 <= z <= k: +for x in range(0, k + 1): +    for y in range(0, k + 1): +        if 0 <= s - x - y <= k: