k=int(input())
a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,k+1):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)
 k=int(input()) k int(input()) int input() input a=[] a [] judge=0 judge 0 a.append("") a.append a append "" a.append(7%k) a.append a append 7%k 7 k for i in range(2,k+1):
    a.append((a[i-1]*10+7)%k) i range(2,k+1) range 2 k+1 k 1 a.append((a[i-1]*10+7)%k) a.append a append (a[i-1]*10+7)%k a[i-1]*10+7 a[i-1]*10 a[i-1] a i-1 i 1 10 7 k for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break i range(1,k+1) range 1 k+1 k 1 if a[i]==0:
        print(i)
        judge=1
        break a[i]==0 a[i] a i 0 print(i) print i judge=1 judge 1 break if judge==0:
    print(-1) judge==0 judge 0 print(-1) print -1 judge=0 0 judge judge=1 1 judge a=[] [] a k=int(input()) int(input()) k
k=int(input())
a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,k+1):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)

