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



ans = 0

for i in range(K+1):

    x = i

    for j in range(K+1):

        y = j

        z = S - x - y

        if 0 <= z <= K:

            ans += 1



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



count = 0

for x in range(K+1):

    for y in range(K+1):

        if 0 <= S - (x + y) <= K:

            count += 1



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

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

-ans = 0 -for i in range(K + 1): -    x = i -    for j in range(K + 1): -        y = j -        z = S - x - y -        if 0 <= z <= K: -            ans += 1 -print(ans) +count = 0 +for x in range(K + 1): +    for y in range(K + 1): +        if 0 <= S - (x + y) <= K: +            count += 1 +print(count)