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 <= K:

      cnt+=1

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

print((sum(1for x in range(K+1)for y in range(K+1)if 0<=S-x-y<=K)))
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 <= K:
            cnt += 1
print(cnt)

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

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