k=int(input())
if(k%2==0 or k%5==0):
	print(-1)
else:
	s=7
	count=1
	while(s%k!=0):
		s=(10*s+7)%k
		count+=1
	print(count)
 k=int(input()) k int(input()) int input() input if(k%2==0 or k%5==0):
	print(-1)
else:
	s=7
	count=1
	while(s%k!=0):
		s=(10*s+7)%k
		count+=1
	print(count) k%2==0 or k%5==0 k%2==0 k%2 k 2 0 k%5==0 k%5 k 5 0 print(-1) print -1 s=7 s 7 count=1 count 1 while(s%k!=0):
		s=(10*s+7)%k
		count+=1
	 s%k!=0 s%k s k 0 s=(10*s+7)%k s (10*s+7)%k 10*s+7 10*s 10 s 7 k count+=1 count 1 print(count) print count s=7 7 s count=1 1 count count+=1 1 count s=(10*s+7)%k (10*s+7)%k s k=int(input()) int(input()) k
k=int(input())
if(k%2==0 or k%5==0):
	print(-1)
else:
	s=7
	count=1
	while(s%k!=0):
		s=(10*s+7)%k
		count+=1
	print(count)

