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

count = 0



for x in range(K + 1):

    if x > S:

        break

    for y in range(K + 1):

        z = S - (x + y)

        if z < 0:

            break

        if 0 <= z and z <= K:

            count += 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 and z <= K:

            count += 1



print(count)

K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
    if x > S:
        break
    for y in range(K + 1):
        z = S - (x + y)
        if z < 0:
            break
        if 0 <= z and z <= K:
            count += 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 and z <= K:
            count += 1
print(count)

-    if x > S: -        break -        if z < 0: -            break