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

a = 0



for X in range(K+1):

  for Y in range(K+1):

    if 0<=S-X-Y<=K:

      a+=1



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

print((sum([0<=S-X-Y<=K for X in range(K+1) for Y in range(K+1)])))
K, S = list(map(int, input().split()))
a = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if 0 <= S - X - Y <= K:
            a += 1
print(a)

K, S = list(map(int, input().split()))
print((sum([0 <= S - X - Y <= K for X in range(K + 1) for Y in range(K + 1)])))

-a = 0 -for X in range(K + 1): -    for Y in range(K + 1): -        if 0 <= S - X - Y <= K: -            a += 1 -print(a) +print((sum([0 <= S - X - Y <= K for X in range(K + 1) for Y in range(K + 1)])))