#1-6-1  #ABC051B

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

count=0

for x in range(k+1):

    for y in range(k+1):

        if s-x-y<=k and s-x-y>=0:count+=1

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

ans=0

for x in range(min(s+1,k+1)):

    first=s-x

    for y in range(min(first+1,k+1)):

               if first-y >=0and first-y<=k:

                   ans+=1

print(ans)
# 1-6-1  #ABC051B
k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        if s - x - y <= k and s - x - y >= 0:
            count += 1
print(count)

k, s = list(map(int, input().split()))
ans = 0
for x in range(min(s + 1, k + 1)):
    first = s - x
    for y in range(min(first + 1, k + 1)):
        if first - y >= 0 and first - y <= k:
            ans += 1
print(ans)

-# 1-6-1  #ABC051B -count = 0 -for x in range(k + 1): -    for y in range(k + 1): -        if s - x - y <= k and s - x - y >= 0: -            count += 1 -print(count) +ans = 0 +for x in range(min(s + 1, k + 1)): +    first = s - x +    for y in range(min(first + 1, k + 1)): +        if first - y >= 0 and first - y <= k: +            ans += 1 +print(ans)