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

num=0

for X in range(S+1):

    if X>K:

        break

    for Y in range(S+1):

        Z=S-X-Y

        if Y<=K and K>=Z>=0:

            num+=1

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

#K=5

#S=15

num=0

for X in range(K+1):

    if X>S:

        break

    for Y in range(K+1):

        Z=S-Y-X

        if 0<=Z<=K:

            

            num+=1

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

K, S = list(map(int, input().split()))
# K=5
# S=15
num = 0
for X in range(K + 1):
    if X > S:
        break
    for Y in range(K + 1):
        Z = S - Y - X
        if 0 <= Z <= K:
            num += 1
print(num)

+# K=5 +# S=15 -for X in range(S + 1): -    if X > K: +for X in range(K + 1): +    if X > S: -    for Y in range(S + 1): -        Z = S - X - Y -        if Y <= K and K >= Z >= 0: +    for Y in range(K + 1): +        Z = S - Y - X +        if 0 <= Z <= K: