let kstr = readLine()!
let k = Int(kstr)!
let seven = 7
var dev = 7
var inc = 1
var count = 0
while true {
  if(k % 2 == 0){
      print("-1")
      break
  }
  count += 1
  if(dev%k == 0){
    print(count)
    break
  }
  inc = inc*10
  dev += dev*inc
}

if(count == 0){
    print("-1")
}