import Foundation

let k = Int(readLine()!)!
let limit = 1000000
var mod = 7 % k
var exist = false
if (mod == 0) {
  print(1)
} else  {
  for i in (1...limit) {
  	mod = ((mod % k) * (10 % k) + (7 % k)) % k
    if mod == 0 {
      print(i + 1)
      exist = true
      break
    }
  }
}

if !exist {
  print(-1)
}