K = int(input())

seen = set()
extra = 7 % K
cnt = 1
seen.add(extra)
while extra != 0:
    extra = (extra * 10 + 7) % K
    if extra in seen:
        print(-1)
        exit()
    seen.add(extra)
    cnt += 1

print(cnt) K = int(input()) K int(input()) int input() input seen = set() seen set() set extra = 7 % K extra 7 % K 7 K cnt = 1 cnt 1 seen.add(extra) seen.add seen add extra while extra != 0:
    extra = (extra * 10 + 7) % K
    if extra in seen:
        print(-1)
        exit()
    seen.add(extra)
    cnt += 1 extra != 0 extra 0 extra = (extra * 10 + 7) % K extra (extra * 10 + 7) % K extra * 10 + 7 extra * 10 extra 10 7 K if extra in seen:
        print(-1)
        exit()
     extra in seen extra seen print(-1) print -1 exit() exit seen.add(extra) seen.add seen add extra cnt += 1 cnt 1 print(cnt) print cnt cnt = 1 1 cnt extra = 7 % K 7 % K extra seen = set() set() seen cnt += 1 1 cnt extra = (extra * 10 + 7) % K (extra * 10 + 7) % K extra K = int(input()) int(input()) K
K = int(input())

seen = set()
extra = 7 % K
cnt = 1
seen.add(extra)
while extra != 0:
    extra = (extra * 10 + 7) % K
    if extra in seen:
        print(-1)
        exit()
    seen.add(extra)
    cnt += 1

print(cnt)