#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int div(int n){
int c=1,temp=7;
while(temp%n!=0){
temp=(temp%n)*10+7;
c++;
}
return c;
}
int main()
{
int n;
cin>>n;
if(n%2==0 || n%5==0){
cout<<-1;
return 0;
}
cout<<div(n);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nIGludAp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgZGl2KGludCBuKXsKICAgIGludCBjPTEsdGVtcD03OwogICAgd2hpbGUodGVtcCVuIT0wKXsKICAgICAgICB0ZW1wPSh0ZW1wJW4pKjEwKzc7CiAgICAgICAgYysrOwogICAgfQogICAgcmV0dXJuIGM7Cn0KaW50IG1haW4oKQp7CiAgICBpbnQgbjsKICAgIGNpbj4+bjsKICAgIGlmKG4lMj09MCB8fCBuJTU9PTApewogICAgICAgIGNvdXQ8PC0xOwogICAgICAgIHJldHVybiAwOwogICAgfQogICAgY291dDw8ZGl2KG4pOwogICAgcmV0dXJuIDA7Cn0K