a, b = list(map(int, input().split()))

c = 0

for i in range(a+1):

    for j in range(a+1):

        d = b - i - j

        if 0 <= d <= a:

            c += 1

print(c)

a, b = list(map(int, input().split()))

c = 0

for i in range(a+1):

    for j in range(a+1):

        if 0 <= b - i - j <= a:

            c += 1

print(c)

a, b = list(map(int, input().split()))
c = 0
for i in range(a + 1):
    for j in range(a + 1):
        d = b - i - j
        if 0 <= d <= a:
            c += 1
print(c)

a, b = list(map(int, input().split()))
c = 0
for i in range(a + 1):
    for j in range(a + 1):
        if 0 <= b - i - j <= a:
            c += 1
print(c)

-        d = b - i - j -        if 0 <= d <= a: +        if 0 <= b - i - j <= a: