import std.stdio;

void main() {
  int k;
  readf("%s", &k);

  int x = 7 % k;
  foreach (i;0..k) {
    if (x == 0) {
      writeln(i + 1);
      return;
    }
    x = (x * 10 + 7) % k;
  }
  writeln("-1");
}
