#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n;
	cin>>n;
	int num=0;
	for(int i=1;i<1000001;i++)
	{
		num=(num*10+7)%n;
		if(num==0)
		  {
		  	cout<<i<<endl;
		  	return 0;
		  }
	}
	cout<<"-1"<<endl;
	return 0;
}