K=int(input())
base=7%K
for i in range(1,K+1):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K
print(-1) K=int(input()) K int(input()) int input() input base=7%K base 7%K 7 K for i in range(1,K+1):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K i range(1,K+1) range 1 K+1 K 1 if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K base%K==0 base%K base K 0 print(i) print i exit() exit base=(base*10+7)%K base (base*10+7)%K base*10+7 base*10 base 10 7 K print(-1) print -1 K=int(input()) int(input()) K base=(base*10+7)%K (base*10+7)%K base base=7%K 7%K base
K=int(input())
base=7%K
for i in range(1,K+1):
	if base%K==0:
		print(i)
		exit()
	else:
		base=(base*10+7)%K
print(-1)
