#include<bits/stdc++.h>
#define d 100000000
using namespace std;int main(){long long int n,a=0,count=0;cin>>n;for(int i=0;i<d;i++){a+=7;a%=n;a*=10;count++;if(a==0){break;}}if(a==0)cout<<count;else cout<<-1;}
