# 入力

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

count = 0

for x in range(k+1):

    for y in range(k+1):

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

            count += 1

print(count)

# 入力

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

b = [x for x in range(k+1) for y in range(k+1) if 0<=(s-x-y)<=k]

print((len(b)))

# 入力
k, s = list(map(int, input().split()))
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        if 0 <= (s - x - y) <= k:
            count += 1
print(count)

# 入力
k, s = list(map(int, input().split()))
b = [x for x in range(k + 1) for y in range(k + 1) if 0 <= (s - x - y) <= k]
print((len(b)))

-count = 0 -for x in range(k + 1): -    for y in range(k + 1): -        if 0 <= (s - x - y) <= k: -            count += 1 -print(count) +b = [x for x in range(k + 1) for y in range(k + 1) if 0 <= (s - x - y) <= k] +print((len(b)))