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

number = 0

for x in range(K+1):

  for y in range(K+1):

    z = S - (x + y)

    if 0 <= z <= K:

      number += 1

print(number)

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)



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



ans = 0

for z in range(K+1):

    for y in range(K+1):

        x = S - (z + y)

        if x >= 0 and x <= K:

            ans += 1

print(ans)
K, S = list(map(int, input().split()))
number = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - (x + y)
        if 0 <= z <= K:
            number += 1
print(number)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
K, S = list(map(int, input().split()))
ans = 0
for z in range(K + 1):
    for y in range(K + 1):
        x = S - (z + y)
        if x >= 0 and x <= K:
            ans += 1
print(ans)

+import sys + +input = sys.stdin.readline +sys.setrecursionlimit(10**7) -number = 0 -for x in range(K + 1): +ans = 0 +for z in range(K + 1): -        z = S - (x + y) -        if 0 <= z <= K: -            number += 1 -print(number) +        x = S - (z + y) +        if x >= 0 and x <= K: +            ans += 1 +print(ans)