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



# S-K<=X+Y<=S を満たすX,Yの組の数が答え

ans = 0

for X in range(K+1):

    for Y in range(K+1):

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

            ans += 1



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



# 各ケースごとに格子点の個数を求める

if 0 <= S <= K:

    print((int((S+1)*(S+2)/2)))

elif K < S <= 2*K:

    print((int((K+1)**2 - (2*K-S)*(2*K-S+1)/2 - (S-K)*(S-K+1)/2)))

else:

    print((int((3*K-S+1)*(3*K-S+2)/2)))
K, S = list(map(int, input().split()))
# S-K<=X+Y<=S を満たすX,Yの組の数が答え
ans = 0
for X in range(K + 1):
    for Y in range(K + 1):
        if S - K <= X + Y <= S:
            ans += 1
print(ans)

K, S = list(map(int, input().split()))
# 各ケースごとに格子点の個数を求める
if 0 <= S <= K:
    print((int((S + 1) * (S + 2) / 2)))
elif K < S <= 2 * K:
    print(
        (
            int(
                (K + 1) ** 2
                - (2 * K - S) * (2 * K - S + 1) / 2
                - (S - K) * (S - K + 1) / 2
            )
        )
    )
else:
    print((int((3 * K - S + 1) * (3 * K - S + 2) / 2)))

-# S-K<=X+Y<=S を満たすX,Yの組の数が答え -ans = 0 -for X in range(K + 1): -    for Y in range(K + 1): -        if S - K <= X + Y <= S: -            ans += 1 -print(ans) +# 各ケースごとに格子点の個数を求める +if 0 <= S <= K: +    print((int((S + 1) * (S + 2) / 2))) +elif K < S <= 2 * K: +    print( +        ( +            int( +                (K + 1) ** 2 +                - (2 * K - S) * (2 * K - S + 1) / 2 +                - (S - K) * (S - K + 1) / 2 +            ) +        ) +    ) +else: +    print((int((3 * K - S + 1) * (3 * K - S + 2) / 2)))