#include<iostream>
#include<fstream>
#include<cstdio>
using namespace std;
int K;
int main()
{
	int num=0;
	scanf("%d",&K);
	for(int i=1;i<=1000000;i++){
		num=num*10+7;
		num=num%K;
		if(num==0){printf("%d\n",i);return 0;}
	}
	printf("-1");
	return 0;
}