let () = Scanf.scanf "%d %d" @@ fun k s ->
  Printf.printf "%d\n" @@
  if 3 * k < s
  then 0
  else
    Array.fold_left ( + ) 0 @@
    Array.init (1 + min s k) @@ fun x ->
      Array.fold_left ( + ) 0 @@ Array.init (1 + min (s - x) k) @@ fun y ->
        if s - x - y <= k then 1 else 0


