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

ret = 0

for A in range(S+1):

    if A > K: continue

    for B in range(S+1-A):

        if B > K:continue

        # print(A,B,S-A-B)

        if S-A-B <= K: 

            # print(A,B,S-A-B)

            ret += 1

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

# debug

# print([(A,B,S-A-B) for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K])

print((sum(1 for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K)))
K, S = list(map(int, input().split()))
ret = 0
for A in range(S + 1):
    if A > K:
        continue
    for B in range(S + 1 - A):
        if B > K:
            continue
        # print(A,B,S-A-B)
        if S - A - B <= K:
            # print(A,B,S-A-B)
            ret += 1
print(ret)

K, S = list(map(int, input().split()))
# debug
# print([(A,B,S-A-B) for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K])
print((sum(1 for A in range(K + 1) for B in range(K + 1) if 0 <= S - A - B <= K)))

-ret = 0 -for A in range(S + 1): -    if A > K: -        continue -    for B in range(S + 1 - A): -        if B > K: -            continue -        # print(A,B,S-A-B) -        if S - A - B <= K: -            # print(A,B,S-A-B) -            ret += 1 -print(ret) +# debug +# print([(A,B,S-A-B) for A in range(K+1) for B in range(K+1) if 0 <= S-A-B <= K]) +print((sum(1 for A in range(K + 1) for B in range(K + 1) if 0 <= S - A - B <= K)))