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

cnt = 0



for x in range(K + 1):

    for y in range(K + 1):

        z = S - (x + y)

        cnt += (0 <= z <= K)



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

cnt = 0



for x in range(K + 1):

    S2 = S - x

    if S2 < 0:

        break

    elif S2 > 2*K:

        continue

    else:

        cnt += (S2 + 1) - 2*max(0, S2 - K)



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

K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
    S2 = S - x
    if S2 < 0:
        break
    elif S2 > 2 * K:
        continue
    else:
        cnt += (S2 + 1) - 2 * max(0, S2 - K)
print(cnt)

-    for y in range(K + 1): -        z = S - (x + y) -        cnt += 0 <= z <= K +    S2 = S - x +    if S2 < 0: +        break +    elif S2 > 2 * K: +        continue +    else: +        cnt += (S2 + 1) - 2 * max(0, S2 - K)