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

ret=0

k+=1

for i in range(k):

  for j in range(k):

    d=s-i-j

    if k>d>=0:

      ret+=1

print(ret)

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

dp=[0]*(3*k+4)

dp[0]=1

dp[k+1]=-3

dp[2*k+2]=3

dp[-1]=-1

from itertools import accumulate

dp=list(accumulate(list(accumulate(list(accumulate(dp))))))

print((dp[s]))
k, s = list(map(int, input().split()))
ret = 0
k += 1
for i in range(k):
    for j in range(k):
        d = s - i - j
        if k > d >= 0:
            ret += 1
print(ret)

k, s = list(map(int, input().split()))
dp = [0] * (3 * k + 4)
dp[0] = 1
dp[k + 1] = -3
dp[2 * k + 2] = 3
dp[-1] = -1
from itertools import accumulate

dp = list(accumulate(list(accumulate(list(accumulate(dp))))))
print((dp[s]))

-ret = 0 -k += 1 -for i in range(k): -    for j in range(k): -        d = s - i - j -        if k > d >= 0: -            ret += 1 -print(ret) +dp = [0] * (3 * k + 4) +dp[0] = 1 +dp[k + 1] = -3 +dp[2 * k + 2] = 3 +dp[-1] = -1 +from itertools import accumulate + +dp = list(accumulate(list(accumulate(list(accumulate(dp)))))) +print((dp[s]))