main = getLine >>= print . (cycle [2, 8, 5, 7, 1, 4] !!) . subtract 1 . read