K, S = map(int, input().split())

count = 0
for i in range(K+1):
    for j in range(K+1):
        if(K >= S-(i+j) >= 0):
            count += 1
print(count)

3f401a3f814c7a491f9b93048bd49cc8bf6b50a1
<mask token>

<mask token>
for i in range(K + 1):
    for j in range(K + 1):
        if K >= S - (i + j) >= 0:
            count += 1
print(count)

K, S = map(int, input().split())
count = 0
for i in range(K + 1):
    for j in range(K + 1):
        if K >= S - (i + j) >= 0:
            count += 1
print(count)

K, S = map(int, input().split())

count = 0
for i in range(K+1):
    for j in range(K+1):
        if(K >= S-(i+j) >= 0):
            count += 1
print(count)
