Scanf.scanf "%d" (fun n ->
    let a = Array.init (n + 1) (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let hist = Array.make (n + 1) (-1) in
    let rec loop i =
        let q = a.(i) in
        if hist.(q) = -1 then (
            hist.(q) <- i;
            loop (i + 1)
        ) else
            i - hist.(q)
    in
    let dif = loop 0 in

    let extgcd x y =
        let rec eg r0 r1 a0 a1 b0 b1 =
            if r1 = 0 then a0 else
                let q1 = r0 / r1 in
                eg r1 (r0 mod r1) a1 (a0 - q1 * a1) b1 (b0 - q1 * b1)
        in
        eg x y 1 0 0 1
    in
    let inv x y = (* 1/x in mod y *)
        let c = extgcd x y in
        if c < 0 then c + y else c
    in

    let z = 1000000007 in
    let ( -@) a b = (((a - b) mod z) + z) mod z in
    let ( *@) a b = (a * b) mod z in
    let ( /@) a b = a *@ inv b z in

    let rec loop i a b acc1 c d acc2 =
        if i <= n + 1 then (
            let acc1 = acc1 *@ a /@ b in
            Printf.printf "%d\n" (acc1 -@ acc2);
            let acc2 = acc2 *@ c /@ d in
            loop (i + 1) (a - 1) (b + 1) acc1 (c - 1) (d + 1) acc2
        )
    in
    loop 1 (n + 1) 1 1 (n - dif) 1 1
)