let () =
  let k,s = Scanf.scanf "%d %d " (fun a b -> a,b) in

  let res = ref 0 in

  for i1 = 0 to k do
    for i2 = 0 to k do
      let i3 = s-i1-i2 in
      if i3>=0 && i3<=k then res := !res+1
    done;
  done;

  Printf.printf "%d\n" !res 
