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;print((sum(1for x in r(k+1)for y in r(k+1)if 0<=s-x-y<=k)))
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
print((sum(1 for x in r(k + 1) for y in r(k + 1) if 0 <= s - x - y <= k)))

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