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

ans=0

for x in range(k+1):

  for y in range(k+1):

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

      ans+=1

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

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

k, s = list(map(int, input().split()))
print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))

-ans = 0 -for x in range(k + 1): -    for y in range(k + 1): -        if s - x - y >= 0 and s - x - y <= k: -            ans += 1 -print(ans) +print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))