function main(input) {
    const args = input.split(' ');
    const a = parseInt(args[0], 10);
 
  i = 0
  nanas = 0
  amari = 0
  	while (i <= a){
      nanas = 7 * (10 ** i)
      amari += nanas % a
      amari %= a
      if (amari == 0){
      console.log(i + 1)
      return
      }
      i+=1
    }
  console.log(-1)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));