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



counter = 0

for x in range(K+1):

    for y in range(K+1):

        z = S - x - y

        if 0 <= z <= K:

            counter += 1

print(counter)

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 <= k:

            cnt += 1

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

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

-K, S = list(map(int, input().split())) -counter = 0 -for x in range(K + 1): -    for y in range(K + 1): -        z = S - x - y -        if 0 <= z <= K: -            counter += 1 -print(counter) +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 <= k: +            cnt += 1 +print(cnt)