nyu = eval(input())

nyu = nyu.split()



k = int(nyu[0])

s = int(nyu[1])



n = 0

for x in range(k+1):

  for y in range(k+1):

    if x+y > s or s - (x+y) > k:

      #print(str(x) + " " + str(y))

      continue;

    else:

      n +=1;



print(n)
nyu = eval(input())

nyu = nyu.split()



k = int(nyu[0])

s = int(nyu[1])



n = 0

for x in range(k+1):

  for y in range(k+1):

    if x+y > s:

      break

    elif s - (x+y) > k:

      #print(str(x) + " " + str(y))

      continue;

    else:

      n +=1;



print(n)
nyu = eval(input())
nyu = nyu.split()
k = int(nyu[0])
s = int(nyu[1])
n = 0
for x in range(k + 1):
    for y in range(k + 1):
        if x + y > s or s - (x + y) > k:
            # print(str(x) + " " + str(y))
            continue
        else:
            n += 1
print(n)

nyu = eval(input())
nyu = nyu.split()
k = int(nyu[0])
s = int(nyu[1])
n = 0
for x in range(k + 1):
    for y in range(k + 1):
        if x + y > s:
            break
        elif s - (x + y) > k:
            # print(str(x) + " " + str(y))
            continue
        else:
            n += 1
print(n)

-        if x + y > s or s - (x + y) > k: +        if x + y > s: +            break +        elif s - (x + y) > k: