# your code goes here

[K, S] = input().split()

K = int(K)

S = int(S)



res = 0

for X in range(K+1):

	for Y in range(K+1):

		Z = S - X - Y

		if 0 <= Z <= K:

			res+=1

		

print(res)

[K, S] = input().split()

K = int(K)

S = int(S)



res = 0

for X in range(K+1):

	for Y in range(K+1):

		res += 0 <= S - X - Y <= K

		

print(res)

# your code goes here
[K, S] = input().split()
K = int(K)
S = int(S)
res = 0
for X in range(K + 1):
    for Y in range(K + 1):
        Z = S - X - Y
        if 0 <= Z <= K:
            res += 1
print(res)

[K, S] = input().split()
K = int(K)
S = int(S)
res = 0
for X in range(K + 1):
    for Y in range(K + 1):
        res += 0 <= S - X - Y <= K
print(res)

-# your code goes here -        Z = S - X - Y -        if 0 <= Z <= K: -            res += 1 +        res += 0 <= S - X - Y <= K