import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    if((kotlin%2==0 || kotlin%10 == 5))
        println("-1")
    else {
        var r = 0
        var i = 0
        do {
            r = ((r * 10 + 7) % kotlin).toInt()
            i++
        } while (r != 0)
        println(i)
    }
}
