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

count=0

for x in range(k+1):

    for y in range(k+1):

        if(0<=s-x-y<=k):

            count+=1

        else:continue

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

print((sum(0<=s-x-y<=k for x in range(k+1) for y in range(k+1))))
k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        if 0 <= s - x - y <= k:
            count += 1
        else:
            continue
print(count)

k, s = list(map(int, input().split()))
print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1))))

-count = 0 -for x in range(k + 1): -    for y in range(k + 1): -        if 0 <= s - x - y <= k: -            count += 1 -        else: -            continue -print(count) +print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1))))