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

ans=chk=0

for i in range(k+1):

    for j in range(k+1):

        if (0<=s-i-j<=k): ans+=1

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

ans=0

x=min(k+1,s+1)

y=max(0,s-k-k)

for i in range(y,x):

    for j in range(y,x):

        if i+j>s: break

        if 0<=s-i-j<=k:

            ans+=1

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

k, s = list(map(int, input().split()))
ans = 0
x = min(k + 1, s + 1)
y = max(0, s - k - k)
for i in range(y, x):
    for j in range(y, x):
        if i + j > s:
            break
        if 0 <= s - i - j <= k:
            ans += 1
print(ans)

-ans = chk = 0 -for i in range(k + 1): -    for j in range(k + 1): +ans = 0 +x = min(k + 1, s + 1) +y = max(0, s - k - k) +for i in range(y, x): +    for j in range(y, x): +        if i + j > s: +            break