main :: IO () main = readLn >>= print . f f :: Int -> Int f m = (!! 128) $ iterate (flip mod m . (* 2)) 1