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

n = k + 1

count = 0

for i in range(n):

    for j in range(n):

        if ( 0 <= s - i - j <= k):

          count += 1

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

print((sum(0<=s-i-j<=k for i in range(k+1) for j in range(k+1))))
k, s = list(map(int, input().split()))
n = k + 1
count = 0
for i in range(n):
    for j in range(n):
        if 0 <= s - i - j <= k:
            count += 1
print(count)

k, s = list(map(int, input().split()))
print((sum(0 <= s - i - j <= k for i in range(k + 1) for j in range(k + 1))))

-n = k + 1 -count = 0 -for i in range(n): -    for j in range(n): -        if 0 <= s - i - j <= k: -            count += 1 -print(count) +print((sum(0 <= s - i - j <= k for i in range(k + 1) for j in range(k + 1))))