main :: IO () main = readLn >>= print . solve solve :: Int -> Int solve n = [2,8,5,7,1,4] !! ((n - 1) `mod` 6)