function Main(input) {
  
  input = Number(input)
  
  let output = -1 
  let temp_number777;
  
  if(input%2===0||input%5===0){
  
  }else{
  
   	for(let i=1;;i++){
      	temp_number777 = ""
      for(let g=1;g<=i;g++){
      	temp_number777 += "7"
      }
      temp_number777 = Number(temp_number777)
      
       if(temp_number777%input === 0){
       		output = i
         	break;
       }

    }
  
  }

  	console.log(output)
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));