k,s = list(map(int,input().split()))

Xm = k

Ym = k

Zm = k #使わない

count = 0

for i in range(Xm+1):

  for j in range(Ym+1):

    if 0<= s - (i+j) <= k:

        count += 1

print(count)
k,s = list(map(int,input().split()))

x,y,z = k,k,k

cnt = 0

for i in range(k+1):

    for j in range(k+1):

        if 0<= s - (i+j) <= k:

            cnt +=1

print(cnt)

k, s = list(map(int, input().split()))
Xm = k
Ym = k
Zm = k  # 使わない
count = 0
for i in range(Xm + 1):
    for j in range(Ym + 1):
        if 0 <= s - (i + j) <= k:
            count += 1
print(count)

k, s = list(map(int, input().split()))
x, y, z = k, k, k
cnt = 0
for i in range(k + 1):
    for j in range(k + 1):
        if 0 <= s - (i + j) <= k:
            cnt += 1
print(cnt)

-Xm = k -Ym = k -Zm = k  # 使わない -count = 0 -for i in range(Xm + 1): -    for j in range(Ym + 1): +x, y, z = k, k, k +cnt = 0 +for i in range(k + 1): +    for j in range(k + 1): -            count += 1 -print(count) +            cnt += 1 +print(cnt)