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) and z <= K:

            ANS += 1



print(ANS)
K, S = (int(x) for x in input().split())

ans = 0



for X in range(0, K+1):

    for Y in range(0, K+1):

        Z = S - (X + Y)

        if 0 <= 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) and z <= K:
            ANS += 1
print(ANS)

K, S = (int(x) for x in input().split())
ans = 0
for X in range(0, K + 1):
    for Y in range(0, K + 1):
        Z = S - (X + Y)
        if 0 <= 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) and z <= K: -            ANS += 1 -print(ANS) +K, S = (int(x) for x in input().split()) +ans = 0 +for X in range(0, K + 1): +    for Y in range(0, K + 1): +        Z = S - (X + Y) +        if 0 <= Z <= K: +            ans += 1 +print(ans)