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

print(([0 <= S - x - y <= K for x in range(K+1)

       for y in range(K+1)].count(True)))

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

ans = 0

for x in range(K+1):

    for y in range(K+1):

        ans += 0 <= S - x - y <= K

print(ans)

K, S = list(map(int, input().split()))
print(([0 <= S - x - y <= K for x in range(K + 1) for y in range(K + 1)].count(True)))

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

-print(([0 <= S - x - y <= K for x in range(K + 1) for y in range(K + 1)].count(True))) +ans = 0 +for x in range(K + 1): +    for y in range(K + 1): +        ans += 0 <= S - x - y <= K +print(ans)