fun main(args: Array<String>) {
    val k = readLine()!!.toLong()
 
    if (k % 2 == 0L) return println(-1)
 
    var rem = 0L
    var digit = 1L
    var answer = 0L
 
    repeat(k.toInt()) {
        rem += digit * 7
        rem %= k
        answer++
        if (rem == 0L) return println(answer)
        digit *= 10
        digit %= k
    }
 
    println(-1)
}