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

a = 0



for y in range(K + 1):

     for z in range(K + 1):

        if 0 <= S - y - z <= K:

            a += 1

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

a = 0



for X in range(K + 1):

    for Y in range(K + 1):

        if 0 <= S - X - Y <= K:

            a += 1

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

K, S = list(map(int, input().split()))
a = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if 0 <= S - X - Y <= K:
            a += 1
print(a)

-for y in range(K + 1): -    for z in range(K + 1): -        if 0 <= S - y - z <= K: +for X in range(K + 1): +    for Y in range(K + 1): +        if 0 <= S - X - Y <= K: