fun main(args : Array<String>) {
    val k = readLine()!!.toLong()
    var ans = 0L
    var tmp = 0L

    while (ans < k) {
        tmp *= 10
        tmp += 7
        tmp %= k
        ans++

        if (tmp == 0L) {
            println(ans)
            return
        }
    }

    println(-1)
}