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()))

ans = 0



for x in range(K+1):

    rem = S - x

    if rem < 0: break

    if rem > 2*K: continue

    for y in range(K+1):

        z = rem - y

        if z < 0: break

        if z > K: continue

        ans += 1

print(ans)

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()))
ans = 0
for x in range(K + 1):
    rem = S - x
    if rem < 0:
        break
    if rem > 2 * K:
        continue
    for y in range(K + 1):
        z = rem - y
        if z < 0:
            break
        if z > K:
            continue
        ans += 1
print(ans)

-count = 0 +ans = 0 +    rem = S - x +    if rem < 0: +        break +    if rem > 2 * K: +        continue -        z = S - x - y -        if 0 <= z <= K: -            count += 1 -print(count) +        z = rem - y +        if z < 0: +            break +        if z > K: +            continue +        ans += 1 +print(ans)