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