let () = Scanf.scanf "%d" @@ fun n ->
  let sum = ref 1 in
  let dp = Array.make (n + 1) 1 in
  let is_prime = Array.make (n + 1) true in
  for p = 2 to n do
    if is_prime.(p) then begin
      let rec outer i pp =
        if pp <= n then begin
          let rec inner j =
            if j <= n then begin
              is_prime.(j) <- false;
              dp.(j) <- dp.(j) * (1 + i) / i;
              inner (j + pp)
            end in
          inner pp; outer (i + 1) (pp * p)
        end in
      outer 1 p;
    end;
    sum := p * dp.(p) + !sum
  done;
  Printf.printf "%d\n" !sum
