# coding: utf-8

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

cnt=0

for x in range(K+1):

        yz = S - x

        if yz < 0:

                break

        elif yz > 2*K:

                continue

        else:

                for y in range(K+1):

                        z = S - x - y

                        if 0<=z<=K:

                                cnt+=1

print(cnt)

# coding: utf-8

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

cnt=0

for x in range(K+1):

        yz = S - x

        if yz < 0:

                break

        elif yz > 2*K:

                continue

        else:

                cnt += yz + 1 - 2 * max(0, yz - K)

print(cnt)

# coding: utf-8
K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
    yz = S - x
    if yz < 0:
        break
    elif yz > 2 * K:
        continue
    else:
        for y in range(K + 1):
            z = S - x - y
            if 0 <= z <= K:
                cnt += 1
print(cnt)

# coding: utf-8
K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
    yz = S - x
    if yz < 0:
        break
    elif yz > 2 * K:
        continue
    else:
        cnt += yz + 1 - 2 * max(0, yz - K)
print(cnt)

-        for y in range(K + 1): -            z = S - x - y -            if 0 <= z <= K: -                cnt += 1 +        cnt += yz + 1 - 2 * max(0, yz - K)