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