k = int(input())
if k % 2 == 0:
    print(-1)
else:
    mod = 7 % k
    counter = 1
    memo = 1
    mod_map = set()
    mod_map.add(mod)
    while mod != 0:
        memo = ((memo % k) * (10 % k)) % k
        mod = (mod + 7 * memo) % k
        if mod not in mod_map:
            mod_map.add(mod)
        else:
            counter = -1
            break
        counter += 1
        if mod == 0:
            break
    print(counter) k = int(input()) k int(input()) int input() input if k % 2 == 0:
    print(-1)
else:
    mod = 7 % k
    counter = 1
    memo = 1
    mod_map = set()
    mod_map.add(mod)
    while mod != 0:
        memo = ((memo % k) * (10 % k)) % k
        mod = (mod + 7 * memo) % k
        if mod not in mod_map:
            mod_map.add(mod)
        else:
            counter = -1
            break
        counter += 1
        if mod == 0:
            break
    print(counter) k % 2 == 0 k % 2 k 2 0 print(-1) print -1 mod = 7 % k mod 7 % k 7 k counter = 1 counter 1 memo = 1 memo 1 mod_map = set() mod_map set() set mod_map.add(mod) mod_map.add mod_map add mod while mod != 0:
        memo = ((memo % k) * (10 % k)) % k
        mod = (mod + 7 * memo) % k
        if mod not in mod_map:
            mod_map.add(mod)
        else:
            counter = -1
            break
        counter += 1
        if mod == 0:
            break
     mod != 0 mod 0 memo = ((memo % k) * (10 % k)) % k memo ((memo % k) * (10 % k)) % k (memo % k) * (10 % k) memo % k memo k 10 % k 10 k k mod = (mod + 7 * memo) % k mod (mod + 7 * memo) % k mod + 7 * memo mod 7 * memo 7 memo k if mod not in mod_map:
            mod_map.add(mod)
        else:
            counter = -1
            break
         mod not in mod_map mod mod_map mod_map.add(mod) mod_map.add mod_map add mod counter = -1 counter -1 break counter += 1 counter 1 if mod == 0:
            break
     mod == 0 mod 0 break print(counter) print counter counter = -1 -1 counter memo = 1 1 memo mod_map = set() set() mod_map k = int(input()) int(input()) k mod = (mod + 7 * memo) % k (mod + 7 * memo) % k mod mod = 7 % k 7 % k mod counter = 1 1 counter memo = ((memo % k) * (10 % k)) % k ((memo % k) * (10 % k)) % k memo counter += 1 1 counter
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    mod = 7 % k
    counter = 1
    memo = 1
    mod_map = set()
    mod_map.add(mod)
    while mod != 0:
        memo = ((memo % k) * (10 % k)) % k
        mod = (mod + 7 * memo) % k
        if mod not in mod_map:
            mod_map.add(mod)
        else:
            counter = -1
            break
        counter += 1
        if mod == 0:
            break
    print(counter)
