import java.util.Scanner

import scala.util.control.Breaks

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)

    val k = sc.nextInt()
    var x = 7%k

    val b = new Breaks
    b.breakable {
      for(i <- 1 to k){
        if(x == 0){
          println(i)
          b.break()
        }
        x = (x*10+7)%k
      }
      println(-1)
    }

  }
}
