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

ans = 0

for x in range(K+1):

    for y in range(K+1):

        if x+y<=S and x+y+K >= S:

            ans += 1

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

ans = 0

for i in range(K+1):

    for j in range(K+1):

        if S-K <= i+j <= S:

            ans += 1

print(ans)
K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        if x + y <= S and x + y + K >= S:
            ans += 1
print(ans)

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

-for x in range(K + 1): -    for y in range(K + 1): -        if x + y <= S and x + y + K >= S: +for i in range(K + 1): +    for j in range(K + 1): +        if S - K <= i + j <= S: