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()))

ans = 0

for x in range(k+1):

    for y in range(x, k+1):

        z = s - x - y

        if y<=z and z<=k:

            tmp = set([x,y,z])

            if len(tmp)==3:

                ans += 6

            elif len(tmp)==2:

                ans += 3

            else:

                ans += 1

print(ans)
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()))
ans = 0
for x in range(k + 1):
    for y in range(x, k + 1):
        z = s - x - y
        if y <= z and z <= k:
            tmp = set([x, y, z])
            if len(tmp) == 3:
                ans += 6
            elif len(tmp) == 2:
                ans += 3
            else:
                ans += 1
print(ans)

-cnt = 0 +ans = 0 -    for y in range(k + 1): +    for y in range(x, k + 1): -        if 0 <= z <= k: -            cnt += 1 -print(cnt) +        if y <= z and z <= k: +            tmp = set([x, y, z]) +            if len(tmp) == 3: +                ans += 6 +            elif len(tmp) == 2: +                ans += 3 +            else: +                ans += 1 +print(ans)