open System let read() = Console.ReadLine() |> int let tetra = let rec f a b c d = seq{ yield a yield! f b c d ((a+b+c+d)%17) } f 0 0 0 1 |> Seq.take(1000000+5) |> Seq.toArray let Q = read() Array.init Q (fun _ -> read()) |> Array.iter(fun x -> printfn "%i" tetra.[x-1])