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



count = 0

k = k+1

for x in range(k):

    for y in range(k):

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

                count += 1

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

cnt = 0

for x in range(k+1):

  for y in range(k+1):

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



      cnt += 1

print(cnt)

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

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

-count = 0 -k = k + 1 -for x in range(k): -    for y in range(k): -        if s - (x + y) <= k - 1 and s - (x + y) >= 0: -            count += 1 -print(count) +cnt = 0 +for x in range(k + 1): +    for y in range(k + 1): +        if s - x - y <= k and s - x - y >= 0: +            cnt += 1 +print(cnt)