k = int(input())

svn = 7
cnt = 1
for i in range(10**7):
    svn %= k
    if svn == 0:
        print(cnt)
        exit()
    svn *= 10
    svn += 7
    cnt += 1
print(-1) k = int(input()) k int(input()) int input() input svn = 7 svn 7 cnt = 1 cnt 1 for i in range(10**7):
    svn %= k
    if svn == 0:
        print(cnt)
        exit()
    svn *= 10
    svn += 7
    cnt += 1 i range(10**7) range 10**7 10 7 svn %= k svn k if svn == 0:
        print(cnt)
        exit()
     svn == 0 svn 0 print(cnt) print cnt exit() exit svn *= 10 svn 10 svn += 7 svn 7 cnt += 1 cnt 1 print(-1) print -1 cnt = 1 1 cnt k = int(input()) int(input()) k svn %= k k svn svn += 7 7 svn cnt += 1 1 cnt svn *= 10 10 svn svn = 7 7 svn
k = int(input())

svn = 7
cnt = 1
for i in range(10**7):
    svn %= k
    if svn == 0:
        print(cnt)
        exit()
    svn *= 10
    svn += 7
    cnt += 1
print(-1)