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

cnt = 0

for i in range(0,k+1):

    for j in  range(0,k+1):

        if s-i-j <= k and 0 <= s-i-j:

            cnt += 1

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

c = 0

for x in range(k+1):

    for y in range(k+1):

        z = s-x-y

        if 0<=z<=k:c += 1

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

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

-cnt = 0 -for i in range(0, k + 1): -    for j in range(0, k + 1): -        if s - i - j <= k and 0 <= s - i - j: -            cnt += 1 -print(cnt) +c = 0 +for x in range(k + 1): +    for y in range(k + 1): +        z = s - x - y +        if 0 <= z <= k: +            c += 1 +print(c)