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

c = 0

for x in range(k + 1):

    for y in range(k + 1):

        if 0 <= s - x - y and s - x - y <= k:

            c += 1

print(c)

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()))
c = 0
for x in range(k + 1):
    for y in range(k + 1):
        if 0 <= s - x - y and s - x - y <= k:
            c += 1
print(c)

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)

-c = 0 +ans = 0 -        if 0 <= s - x - y and s - x - y <= k: -            c += 1 -print(c) +        z = s - x - y +        if 0 <= z and z <= k: +            ans += 1 +print(ans)