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()))

print((len([1 for z in range(k+1) for y in range(k+1) if 0<=s-y-z<=k])))
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()))
print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))

-print((sum(0 <= s - x - y <= k for x in range(k + 1) for y in range(k + 1)))) +print((len([1 for z in range(k + 1) for y in range(k + 1) if 0 <= s - y - z <= k])))