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

ans=0

for i in range(n+1):

  for j in range(n+1):

    if s-i-j>-1 and s-i-j<n+1:

      ans+=1

print(ans)

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

ans=0

for i in range(n+1):

  if s-i>n*2 or s-i<0:

    continue

  for j in range(n+1):

    if -1<s-i-j<n+1:

      ans+=1

print(ans)

n, s = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
    for j in range(n + 1):
        if s - i - j > -1 and s - i - j < n + 1:
            ans += 1
print(ans)

n, s = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
    if s - i > n * 2 or s - i < 0:
        continue
    for j in range(n + 1):
        if -1 < s - i - j < n + 1:
            ans += 1
print(ans)

+    if s - i > n * 2 or s - i < 0: +        continue -        if s - i - j > -1 and s - i - j < n + 1: +        if -1 < s - i - j < n + 1: