let _ =
  let k, s = Scanf.scanf "%d %d\n" (fun k s -> k, s) in
  let res = ref 0 in
  for x=0 to k do
    for y=0 to k do
      if (s - x - y) >= 0 && k >= (s - x - y) then res := !res + 1;
    done
  done;
  !res |> print_int
