#include<bits/stdc++.h>
using namespace std;
int main() {
  int k; cin >> k;
  int a = 7;
  for (int i = 0; i < k; i ++) {
    if (a % k == 0) {cout << i + 1 << endl; return 0;}
    a = (10 * a + 7) % k;
  }
  cout << -1 << endl;
}