#ABC951B/Sum_of_Three_Integers



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

ans = 0

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

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

        z = S - x - y

        if 0 <= z and z <= K:

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

        Z = S - X - Y

        if Z >= 0 and Z <= K:

            ans += 1

print(ans)       
# ABC951B/Sum_of_Three_Integers
K, S = list(map(int, input().split()))
ans = 0
for x in range(0, K + 1):
    for y in range(0, K + 1):
        z = S - x - y
        if 0 <= z and z <= K:
            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):
        Z = S - X - Y
        if Z >= 0 and Z <= K:
            ans += 1
print(ans)

-# ABC951B/Sum_of_Three_Integers -for x in range(0, K + 1): -    for y in range(0, K + 1): -        z = S - x - y -        if 0 <= z and z <= K: +for X in range(K + 1): +    for Y in range(K + 1): +        Z = S - X - Y +        if Z >= 0 and Z <= K: