ans = 0

k,s = list(map(int,input().split()))

for x in range(k+1):

	for y in range(k+1):

		z = s - x - y

		if 0 <= z and z <= k:

			ans += 1

print(ans)
k,s=list(map(int,input().split()))

print((sum([max(0,min(k,s-i)-max(0,s-i-k)+1) for i in range(k+1)])))
ans = 0
k, s = list(map(int, input().split()))
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z and z <= k:
            ans += 1
print(ans)

k, s = list(map(int, input().split()))
print((sum([max(0, min(k, s - i) - max(0, s - i - k) + 1) for i in range(k + 1)])))

-ans = 0 -for x in range(k + 1): -    for y in range(k + 1): -        z = s - x - y -        if 0 <= z and z <= k: -            ans += 1 -print(ans) +print((sum([max(0, min(k, s - i) - max(0, s - i - k) + 1) for i in range(k + 1)])))