let count = ref 0

let loop k s =
  for x = 0 to k do
    for y = 0 to k do
      let z = s - x - y in
      if 0 <= z && z <= k then incr count
    done
  done

let () =
  Scanf.scanf "%d %d" loop ;
  Printf.printf "%d\n" !count
