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

cnt = 0

for x in range(K + 1):

    for y in range(K + 1):

        if x + y > S:

            continue

        z = S - x - y

        if z <= K:

            cnt += 1

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

ans = 0

for i in range(K + 1):

    for j in range(K + 1):

        k = S - i - j

        if K >= k >= 0:

            ans += 1

print(ans)

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

K, S = list(map(int, input().split()))
ans = 0
for i in range(K + 1):
    for j in range(K + 1):
        k = S - i - j
        if K >= k >= 0:
            ans += 1
print(ans)

-cnt = 0 -for x in range(K + 1): -    for y in range(K + 1): -        if x + y > S: -            continue -        z = S - x - y -        if z <= K: -            cnt += 1 -print(cnt) +ans = 0 +for i in range(K + 1): +    for j in range(K + 1): +        k = S - i - j +        if K >= k >= 0: +            ans += 1 +print(ans)