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

count = 0

for X in range(K+1):

    for Y in range(K+1):

        if 0<=S-X-Y<=K: #X+Y+Z=S Z=S-X-Y,0<=Z<=K

            count += 1

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

print((len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k])))
K, S = list(map(int, input().split()))
count = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if 0 <= S - X - Y <= K:  # X+Y+Z=S Z=S-X-Y,0<=Z<=K
            count += 1
print(count)

k, s = list(map(int, input().split()))
print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))

-K, S = list(map(int, input().split())) -count = 0 -for X in range(K + 1): -    for Y in range(K + 1): -        if 0 <= S - X - Y <= K:  # X+Y+Z=S Z=S-X-Y,0<=Z<=K -            count += 1 -print(count) +k, s = list(map(int, input().split())) +print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))