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



count = 0

for i in range(K+1):

    for j in range(K+1):

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

            count += 1

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



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

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

-count = 0 -for i in range(K + 1): -    for j in range(K + 1): -        if S - K <= i + j <= S: -            count += 1 -print(count) +print((sum(S - K <= i + j <= S for j in range(K + 1) for i in range(K + 1))))