#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ll k,x=0;
    cin >> k;
    for (int i=1;i<=k;i++) {
        x=(x*10+7)%k;
        if (x==0) {cout << i; return 0;}
    }
    cout << -1 <<endl;
}
