function main(input) {
	var res = 0;
 	input = input.split(',');
  	const max = parseInt(input[0]);
  	const total = parseInt(input[1]);
	for (var X = 0;X <= max;X++) {
    	for (var Y = 0;Y <= max;Y++) {
            var Z = (total - parseInt(X) - parseInt(Y));
           	if (0 <= Z && Z <= max) {
              res++;
            }
        }
    }
	console.log(res);
}

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