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

cnt = 0

for i in range(K+1):

    for j in range(K+1):

        k = S-i-j

        if 0<=k<=K:

            cnt += 1

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

cnt = 0

for X in range(0,K+1):

    for Y in range(0,K+1):

        if 0<=S-X-Y<=K:

            cnt += 1

print(cnt)
K, S = list(map(int, input().split()))
cnt = 0
for i in range(K + 1):
    for j in range(K + 1):
        k = S - i - j
        if 0 <= k <= K:
            cnt += 1
print(cnt)

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

-for i in range(K + 1): -    for j in range(K + 1): -        k = S - i - j -        if 0 <= k <= K: +for X in range(0, K + 1): +    for Y in range(0, K + 1): +        if 0 <= S - X - Y <= K: