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

print(([x+y+s-(x+y) for x in range(k+1) for y in range(k+1) if 0<= s-x-y <= k].count(s)))
k,s=[int(i) for i in input().split()]

print(([x+y+s-(x+y) for x in range(k+1) for y in range(k+1) if 0<= s-x-y <= k].count(s)))
k, s = list(map(int, input().split()))
print(
    (
        [
            x + y + s - (x + y)
            for x in range(k + 1)
            for y in range(k + 1)
            if 0 <= s - x - y <= k
        ].count(s)
    )
)

k, s = [int(i) for i in input().split()]
print(
    (
        [
            x + y + s - (x + y)
            for x in range(k + 1)
            for y in range(k + 1)
            if 0 <= s - x - y <= k
        ].count(s)
    )
)

-k, s = list(map(int, input().split())) +k, s = [int(i) for i in input().split()]