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

cnt = 0

for i in range(K+1):

  for j in range(i, K+1):

    if 0 <= S - i - j <= K:

      if i == j:

        cnt += 1

      else:

        cnt += 2

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

X = (S + 2) * (S + 1)

if S - K - 1 >= 0:

  X -= 3 * (S - K + 1) * (S - K)

if S - 2 * K - 2 >= 0:

  X += 3 * (S - 2 * K) * (S - 2 * K - 1)



print((X // 2))
K, S = list(map(int, input().split()))
cnt = 0
for i in range(K + 1):
    for j in range(i, K + 1):
        if 0 <= S - i - j <= K:
            if i == j:
                cnt += 1
            else:
                cnt += 2
print(cnt)

K, S = list(map(int, input().split()))
X = (S + 2) * (S + 1)
if S - K - 1 >= 0:
    X -= 3 * (S - K + 1) * (S - K)
if S - 2 * K - 2 >= 0:
    X += 3 * (S - 2 * K) * (S - 2 * K - 1)
print((X // 2))

-cnt = 0 -for i in range(K + 1): -    for j in range(i, K + 1): -        if 0 <= S - i - j <= K: -            if i == j: -                cnt += 1 -            else: -                cnt += 2 -print(cnt) +X = (S + 2) * (S + 1) +if S - K - 1 >= 0: +    X -= 3 * (S - K + 1) * (S - K) +if S - 2 * K - 2 >= 0: +    X += 3 * (S - 2 * K) * (S - 2 * K - 1) +print((X // 2))