main=do n <- readLn :: IO Integer print $ (n ^ 3) `mod` 1000000007