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

ret = 0

for i in range(k+1):

    for j in range(k+1):

        if i + j <= s <= i + j + k:

            ret += 1

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

ret = 0

for i in range(k+1):

    ret += max(0,min(s-i, 2*k-s+i)+1)

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

k, s = list(map(int, input().split()))
ret = 0
for i in range(k + 1):
    ret += max(0, min(s - i, 2 * k - s + i) + 1)
print(ret)

-    for j in range(k + 1): -        if i + j <= s <= i + j + k: -            ret += 1 +    ret += max(0, min(s - i, 2 * k - s + i) + 1)