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

cnt = 0

for x in range(k+1):

  for y in range(k+1):

    if s-(x+y) >=0 and s-(x+y) <= k:

      cnt += 1

print(cnt)


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



def est():

  cnt = 0

  for x in range(k+1):

    for y in range(k+1):

      if s-(x+y) >=0 and s-(x+y) <= k:

        cnt += 1

  return cnt

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

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


def est():
    cnt = 0
    for x in range(k + 1):
        for y in range(k + 1):
            if s - (x + y) >= 0 and s - (x + y) <= k:
                cnt += 1
    return cnt


print((est()))

-cnt = 0 -for x in range(k + 1): -    for y in range(k + 1): -        if s - (x + y) >= 0 and s - (x + y) <= k: -            cnt += 1 -print(cnt) + + +def est(): +    cnt = 0 +    for x in range(k + 1): +        for y in range(k + 1): +            if s - (x + y) >= 0 and s - (x + y) <= k: +                cnt += 1 +    return cnt + + +print((est()))