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
      for i3 = 0 to k do
        if i1 + i2 + i3 = s then res := !res + 1
      done;
    done;
  done;

  Printf.printf "%d\n" !res 
