inputs= list(map(int,input().split()))

k = inputs[0]

s = inputs[1]

answer = 0

for i in range(k+1):

  x = i

  for l in range(k+1):

    y = l

    z = s-x-y

    if z >= 0 and z <= k :

      answer += 1

print(answer)
a = list(map(int,input().split()))

k = a[0]

s = a[1]

num=0

for l in range(k+1):

    for m in range(k+1):

        n = s-l-m

        if(n <= k and n >= 0):

            num+=1



print(num)
inputs = list(map(int, input().split()))
k = inputs[0]
s = inputs[1]
answer = 0
for i in range(k + 1):
    x = i
    for l in range(k + 1):
        y = l
        z = s - x - y
        if z >= 0 and z <= k:
            answer += 1
print(answer)

a = list(map(int, input().split()))
k = a[0]
s = a[1]
num = 0
for l in range(k + 1):
    for m in range(k + 1):
        n = s - l - m
        if n <= k and n >= 0:
            num += 1
print(num)

-inputs = list(map(int, input().split())) -k = inputs[0] -s = inputs[1] -answer = 0 -for i in range(k + 1): -    x = i -    for l in range(k + 1): -        y = l -        z = s - x - y -        if z >= 0 and z <= k: -            answer += 1 -print(answer) +a = list(map(int, input().split())) +k = a[0] +s = a[1] +num = 0 +for l in range(k + 1): +    for m in range(k + 1): +        n = s - l - m +        if n <= k and n >= 0: +            num += 1 +print(num)