
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val K = sc.nextInt()
  var i = 1
  var x = 7 % K
  while(x != 0 && i <= K) {
    x = (x * 10 + 7) % K
    i += 1
  }
  if (i > K) {
    println(-1)
  } else {
    println(i)
  }
}
