K = int(input())
nana=7
kou=1
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
    print(kou) K = int(input()) K int(input()) int input() input nana=7 nana 7 kou=1 kou 1 if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
    print(kou) 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 for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
     i range(1,K) range 1 K if nana % K == 0:
            break
         nana % K == 0 nana % K nana K 0 break nana = (nana * 10 + 7) % K nana (nana * 10 + 7) % K nana * 10 + 7 nana * 10 nana 10 7 K kou +=1 kou 1 print(kou) print kou kou +=1 1 kou K = int(input()) int(input()) K nana=7 7 nana kou=1 1 kou nana = (nana * 10 + 7) % K (nana * 10 + 7) % K nana
K = int(input())
nana=7
kou=1
if K % 2 == 0 or K % 5 == 0:
    print(-1)
else:
    for i in range(1,K):
        if nana % K == 0:
            break
        nana = (nana * 10 + 7) % K
        kou +=1
    print(kou)