k,s=list(map(int, input().split()))

r=range

ans=[1 for x in r(k+1) for y in r(k+1)if x+y<=s and s-x-y<=k]

print((sum(ans)))
k,s=list(map(int,input().split()));r=range;print((sum(1 for x in r(k+1) for y in r(k+1)if x+y<=s and s-x-y<=k)))
k, s = list(map(int, input().split()))
r = range
ans = [1 for x in r(k + 1) for y in r(k + 1) if x + y <= s and s - x - y <= k]
print((sum(ans)))

k, s = list(map(int, input().split()))
r = range
print((sum(1 for x in r(k + 1) for y in r(k + 1) if x + y <= s and s - x - y <= k)))

-ans = [1 for x in r(k + 1) for y in r(k + 1) if x + y <= s and s - x - y <= k] -print((sum(ans))) +print((sum(1 for x in r(k + 1) for y in r(k + 1) if x + y <= s and s - x - y <= k)))