let m = 1000000007
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m

let rec power ( * ) e m n =
  if n <= 0 then e
  else power ( * ) (if n land 1 = 0 then e else m * e) (m * m) (n lsr 1)

let rec factorize acc i n =
  if n <= 1 then acc
  else if n < i * i then n :: acc
  else if n mod i = 0 then factorize (i :: acc) i (n / i)
  else factorize acc (i + 1) n
let factorize n =
  match factorize [] 2 n with
  | [] -> []
  | p :: ps ->
      let (acc, p, n) = List.fold_left (fun (acc, p, n) q ->
        if p = q
        then (acc, p, n + 1)
        else ((p, n) :: acc, q, 1)) ([], p, 1) ps in
      (p, n) :: acc

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let factors = Array.make 1000000 0 in
  Array.iter (fun a ->
    List.iter (fun (p, n) -> factors.(p) <- max n factors.(p)) @@ factorize a) as_;
  let lcm =
    Array.fold_left ( *^ ) 1 @@
    Array.init 1000000 @@ fun p -> power ( *^ ) 1 p factors.(p) in
  Printf.printf "%d\n" @@
  Array.fold_right (fun a -> ( +^ ) @@ power ( *^ ) lcm a (m - 2)) as_ 0

