"use strict";

function main(input) {
    input = input.split(' ');
  	const K = parseInt(input[0]);
  	const S = parseInt(input[1]);
    let C = []
    
    if(S < 0 || S > 3 * K) {
        console.log("error")
    }
    if(K < 2 || K > 2500) {
        console.log("error")
    }
    
    if(S === 3 * K) {
        C.push([K,K,K])
    } else {
        for(let i = 0; i <= K; i++) {
            for(let j = 0; j <= K; j++) {
                for(let k = 0; k <= K; k++) {
                    const s = i+j+k
                    if(s<=3 * K && i+j+k===S) {
                        C.push([i,j,k])
                    }
                }
            }
        }
    }
    
    console.log(`There are ${C.length} combination(s)`)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));