module M = Map.Make (struct type t = int let compare = compare end) ;;
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let z = 1_000_000_007 in
    let ( +@) a b = (a + b) mod z in
    let ( *@) a b = ((a mod z) * (b mod z)) mod z in

    let add k v map = M.add k (v + try M.find k map with _ -> 0) map in

    let factor a =
        let rec loop rest i map =
            if rest = 1 then map else
                if rest < i * i then add rest 1 map else
                    if rest mod i <> 0 then loop rest (i + 1) map else
                        let rec count r v =
                            if r mod i = 0 then count (r / i) (v + 1) else
                                loop r (i + 1) (add i v map)
                        in
                        count rest 0
        in
        loop a 2 M.empty
    in

    let gcd a b =
        M.fold (fun k v acc -> if M.mem k b then add k (min (M.find k b) v) acc else acc) a M.empty
    in

    let pow_mod a b =
        let rec loop r i acc =
            if i = 0 then acc else
                let acc = if i land 1 = 1 then acc *@ r else acc in
                loop (r *@ r) (i lsr 1) acc
        in
        loop a b 1
    in
    let reduce map = M.fold (fun k v acc -> acc *@ pow_mod k v) map 1 in
    let mul a b = M.fold add a b in
    let div a b =
        M.fold (fun k v acc ->
            if M.mem k acc then (
                let c = M.find k acc  - v in
                if c <> 0 then M.add k c acc else M.remove k acc
            ) else M.add k (-v) acc
        ) b a
    in

    let lcm a b = div (mul a b) (gcd a b) in

    let rec loop i acc =
        if i = n then acc else loop (i + 1) (lcm acc (factor a.(i)))
    in
    let l = loop 1 (factor a.(0)) in
   Array.fold_left (fun acc v -> acc +@ reduce (div l (factor v))) 0 a |> Printf.printf "%d\n"
)