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

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

s = 0

for x in range(min(S,K)+1):

  for y in range(min(S-x,K)+1):

    if S-x-y<=K:

      s += 1

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

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

-print((sum(0 <= S - x - y <= min(K, S) for x in range(K + 1) for y in range(K + 1)))) +s = 0 +for x in range(min(S, K) + 1): +    for y in range(min(S - x, K) + 1): +        if S - x - y <= K: +            s += 1 +print(s)