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

cnt = 0

for i in range(k+1):

    for j in range(k+1):

        n = s-i-j

        if n>=0 and n<=k:

            cnt += 1

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

ans = 0

for i in range(k+1):

    for j in range(k+1):

        if i+j<=s and s-i-j<=k: ans+=1

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

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

-cnt = 0 +ans = 0 -        n = s - i - j -        if n >= 0 and n <= k: -            cnt += 1 -print(cnt) +        if i + j <= s and s - i - j <= k: +            ans += 1 +print(ans)