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

int main(){
int k; cin>>k;
int ans  = 0;
int count  = 0;
while(count <1000001){
ans = (ans*10 + 7)%k;
count++;
if(!ans){
cout<<count;
return 0;
}
}
cout<<-1;
}