from sys import stdin

k,s = list(map(int,stdin.readline().rstrip().split()))

point = 0

for i in range(k+1):

    for j in range(k+1):

        if i+j > s:

            continue

        elif s-(i+j) <= k:

            point += 1

print(point)
from sys import stdin

k,s = list(map(int,stdin.readline().rstrip().split()))

point = 0

for i in range(k+1):

    for j in range(k+1):

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

            point += 1

print(point)
from sys import stdin

k, s = list(map(int, stdin.readline().rstrip().split()))
point = 0
for i in range(k + 1):
    for j in range(k + 1):
        if i + j > s:
            continue
        elif s - (i + j) <= k:
            point += 1
print(point)

from sys import stdin

k, s = list(map(int, stdin.readline().rstrip().split()))
point = 0
for i in range(k + 1):
    for j in range(k + 1):
        if 0 <= s - (i + j) <= k:
            point += 1
print(point)

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