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()))

cnt = 0

from itertools import product as prd

for x, y in prd(list(range(K+1)),list(range(K+1))):

    if 0 <= S-x-y <= 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 0 <= z <= K:
            cnt += 1
print(cnt)

K, S = list(map(int, input().split()))
cnt = 0
from itertools import product as prd

for x, y in prd(list(range(K + 1)), list(range(K + 1))):
    if 0 <= S - x - y <= K:
        cnt += 1
print(cnt)

-for x in range(K + 1): -    for y in range(K + 1): -        z = S - x - y -        if 0 <= z <= K: -            cnt += 1 +from itertools import product as prd + +for x, y in prd(list(range(K + 1)), list(range(K + 1))): +    if 0 <= S - x - y <= K: +        cnt += 1