K , S = list(map(int,input().split()))

count = 0

for x in range(K + 1):

  for y in range(K + 1):

    z = S - x - y

    if(0 <= z <= K):

      count += 1

print(count)
K , S = list(map(int,input().split()))

count = 0

for x in range(K+1):

  for y in range(max(0,S-K-x), min(K+1,S-x+1)):

    count += 1

print(count)
K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            count += 1
print(count)

K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
    for y in range(max(0, S - K - x), min(K + 1, S - x + 1)):
        count += 1
print(count)

-    for y in range(K + 1): -        z = S - x - y -        if 0 <= z <= K: -            count += 1 +    for y in range(max(0, S - K - x), min(K + 1, S - x + 1)): +        count += 1