fun main(args: Array<String>) {
  val K = readLine()!!.toInt()
  var m = 0
  var ans = -1
  for (i in 1..K) {
      m = (10 * m + 7) % K
      if (m == 0) {
          ans = i
          break
      }
  }
  println(ans)
}
