main = do n <- read <$> getLine putStrLn $ show $ modIOI n 1000000007 putStrLn $ show $ modIOI n 101010101010101010101 modIOI an m | an == 1 = 1 | even an = let half = modIOI (div an 2) m in mod (half * modExp 10 an m + half) m | otherwise = let half = modIOI (div an 2) m in mod (half * modExp 10 (2*div an 2) m + half + modExp 10 (2*an-2) m) m modExp b e m | e == 0 = 1 | even e = let half = modExp b (div e 2) m in mod (half*half) m | otherwise = let half = modExp b (div e 2) m in mod (b*half*half) m