import Data.Maybe
import Data.List

main = do
    k <- readLn :: IO Int
    let x = elemIndex 0 $ take k (iterate (\i -> (i * 10 + 7) `mod` k) (7 `mod` k))
    if x == Nothing
        then print $ -1
        else print $ (fromJust x) + 1
