fun main() {
    // 文字列
    var k = readLine()!!.toInt()
//    val x: String = readLine()!!
    // 数値
//    val int =readLine()!!.toInt()
    // 行
//    val list = readLine()!!.split(" ").map (String::toInt )
//    val (n,d) = readLine()!!.split(" ").map(String::toInt)
//    val xys = List(n) {
////        readLine()!!.split(" ").map(String::toLong)
//        readLine()!!.toDouble()
//    }

    var x=7%k
    var count=1

    for (i in 0 until k){
        if (x==0) {
            print(count)
            return
        }
        x=(x*10+7)%k
        count=count+1
    }
    print(-1)
}