open System.Numerics let mutable n = stdin.ReadLine () |> int64 let mutable s = "1" while n > 0L do s <- s + "3" n <- n-1L (BigInteger.Parse s) % (bigint 1000000007) |> printfn "%A"