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



ans = 0

for x in range(K + 1):

    for y in range(K + 1):

        z = S - (x + y)

        if 0 <= z and z <= K:

            ans += 1



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



ans = 0

for x in range(K + 1):

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

        z = S - (x + y)

        if y <= z and z <= K:

            if x == y and y == z:

                ans += 1

            elif x == y or y == z or z == x:

                ans += 3

            else:

                ans += 6



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

K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
    for y in range(x, K + 1):
        z = S - (x + y)
        if y <= z and z <= K:
            if x == y and y == z:
                ans += 1
            elif x == y or y == z or z == x:
                ans += 3
            else:
                ans += 6
print(ans)

-    for y in range(K + 1): +    for y in range(x, K + 1): -        if 0 <= z and z <= K: -            ans += 1 +        if y <= z and z <= K: +            if x == y and y == z: +                ans += 1 +            elif x == y or y == z or z == x: +                ans += 3 +            else: +                ans += 6