import Data.Ratio
import Control.Monad
import Data.Maybe
import Data.List
import qualified Data.ByteString.Char8 as BS

main = abc159c

abc159c = do
  [l] <- getIntList
  print (fromRational (calcV l) :: Double)

calcV l = (l % 3)^3

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine