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

count = 0

for i in range(K+1):

    for j in range(K+1):

        if 0 <= S - i - j and S - i - j <= K:

            count += 1

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



res = 0



for X in range(min(S, K), -1, -1):

    for Y in range(min(K, S - X), -1, -1):

        if 0 <= S - X - Y <= K:

            res += 1

print(res)
K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
    for j in range(K + 1):
        if 0 <= S - i - j and S - i - j <= K:
            count += 1
print(count)

K, S = list(map(int, input().split()))
res = 0
for X in range(min(S, K), -1, -1):
    for Y in range(min(K, S - X), -1, -1):
        if 0 <= S - X - Y <= K:
            res += 1
print(res)

-count = 0 -for i in range(K + 1): -    for j in range(K + 1): -        if 0 <= S - i - j and S - i - j <= K: -            count += 1 -print(count) +res = 0 +for X in range(min(S, K), -1, -1): +    for Y in range(min(K, S - X), -1, -1): +        if 0 <= S - X - Y <= K: +            res += 1 +print(res)