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;ans+=(0<=z<=K)

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

print((sum(0<=S-x-y<=K for x in range(K+1)for y in range(K+1))))
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
        ans += 0 <= z <= K
print(ans)

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

-ans = 0 -for x in range(K + 1): -    for y in range(K + 1): -        z = S - x - y -        ans += 0 <= z <= K -print(ans) +print((sum(0 <= S - x - y <= K for x in range(K + 1) for y in range(K + 1))))