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 z >= 0 and z <= k :

            ans += 1

            

print(ans)

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

ans = 0

for x in range(K+1) :

    for y in range(K+1) :

        z = S-x-y

        if 0 <= z <= K :

            ans += 1

print(ans)
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 z >= 0 and z <= k:
            ans += 1
print(ans)

K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            ans += 1
print(ans)

+K, S = list(map(int, input().split())) -k, s = list(map(int, input().split())) -for x in range(k + 1): -    for y in range(k + 1): -        z = s - (x + y) -        if z >= 0 and z <= k: +for x in range(K + 1): +    for y in range(K + 1): +        z = S - x - y +        if 0 <= z <= K: