fun main() {
    val k = readLine()!!.toLong()
    if (k % 2L == 0L || k % 5L == 0L) {
        println(-1)
    } else {
        var curr = 0L
        for (answer in 1..100000000) {
            curr *= 10L
            curr += 7L
            curr %= k
            if (curr == 0L) {
                println(answer)
                break
            }
        }
    }
}