k,s=list(map(int,input().split()));k+=1;print((sum(k>s-I//k-I%k>=0for I in range(k*k))))
k,s=list(map(int,input().split()));print((sum(max(0,min(2*k+i-s+1,s-i+1))for i in range(k+1))))
k, s = list(map(int, input().split()))
k += 1
print((sum(k > s - I // k - I % k >= 0 for I in range(k * k))))

k, s = list(map(int, input().split()))
print((sum(max(0, min(2 * k + i - s + 1, s - i + 1)) for i in range(k + 1))))

-k += 1 -print((sum(k > s - I // k - I % k >= 0 for I in range(k * k)))) +print((sum(max(0, min(2 * k + i - s + 1, s - i + 1)) for i in range(k + 1))))