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

cnt = 0

for x in range(k + 1):

    for y in range(k + 1):

        z = s - (x + y)

        if (0 <= z) and (z <= k):

            cnt += 1

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



cnt = 0

for x in range(k + 1):

    for y in range(k + 1):

        z = s - (x + y)

        if not (0 <= z <= k):

            continue

        cnt += 1

print(cnt)

k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - (x + y)
        if (0 <= z) and (z <= k):
            cnt += 1
print(cnt)

k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - (x + y)
        if not (0 <= z <= k):
            continue
        cnt += 1
print(cnt)

-        if (0 <= z) and (z <= k): -            cnt += 1 +        if not (0 <= z <= k): +            continue +        cnt += 1