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

t = 0



for i in range(k+1):

    for j in range(k+1):

        if k >= s - i - j and 0 <= s - i - j:

            t += 1



print(t)
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 <= k:

            ans += 1

print(ans)
k, s = list(map(int, input().split()))
t = 0
for i in range(k + 1):
    for j in range(k + 1):
        if k >= s - i - j and 0 <= s - i - j:
            t += 1
print(t)

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 <= k:
            ans += 1
print(ans)

-t = 0 -for i in range(k + 1): -    for j in range(k + 1): -        if k >= s - i - j and 0 <= s - i - j: -            t += 1 -print(t) +ans = 0 +for x in range(k + 1): +    for y in range(k + 1): +        z = s - (x + y) +        if 0 <= z <= k: +            ans += 1 +print(ans)