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



cnt = 0

for x in range(K+1):

  for y in range(K+1):

    z = S-x-y

    if 0 <= z and z <= K:

      cnt+=1



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

ans = sum(0 <= S-x-y <= K for x in range(K+1) for y in range(K+1))

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

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

-cnt = 0 -for x in range(K + 1): -    for y in range(K + 1): -        z = S - x - y -        if 0 <= z and z <= K: -            cnt += 1 -print(cnt) +ans = sum(0 <= S - x - y <= K for x in range(K + 1) for y in range(K + 1)) +print(ans)