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

515027f9f6b32c24f1d6e3ca246ca2b458e46935
<mask token>

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

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