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

            ans += 1



print(ans)

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



cnt = 0

for i in range(K+1):

    for j in range(K+1):

        x = S - i - j

        if 0 <= x <= K:

            cnt += 1

print(cnt)

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 z >= 0 and z <= K:
            ans += 1
print(ans)

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

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