K = int(input())
id = 1
cnt = 7
while cnt < K:
    cnt = cnt * 10 + 7
    id += 1

visited = [0] * K
while True:
    remz = (cnt % K)
    if remz == 0:
        break
    visited[remz] += 1
    if visited[remz] > 1:
        id = -1
        break
    cnt = remz * 10 + 7
    id += 1

print(id) K = int(input()) K int(input()) int input() input id = 1 id 1 cnt = 7 cnt 7 while cnt < K:
    cnt = cnt * 10 + 7
    id += 1 cnt < K cnt K cnt = cnt * 10 + 7 cnt cnt * 10 + 7 cnt * 10 cnt 10 7 id += 1 id 1 visited = [0] * K visited [0] * K [0] 0 K while True:
    remz = (cnt % K)
    if remz == 0:
        break
    visited[remz] += 1
    if visited[remz] > 1:
        id = -1
        break
    cnt = remz * 10 + 7
    id += 1 True remz = (cnt % K) remz cnt % K cnt K if remz == 0:
        break
     remz == 0 remz 0 break visited[remz] += 1 visited[remz] visited remz 1 if visited[remz] > 1:
        id = -1
        break
     visited[remz] > 1 visited[remz] visited remz 1 id = -1 id -1 break cnt = remz * 10 + 7 cnt remz * 10 + 7 remz * 10 remz 10 7 id += 1 id 1 print(id) print id cnt = remz * 10 + 7 remz * 10 + 7 cnt K = int(input()) int(input()) K id += 1 1 id remz = (cnt % K) cnt % K remz id += 1 1 id id = -1 -1 id visited = [0] * K [0] * K visited cnt = cnt * 10 + 7 cnt * 10 + 7 cnt cnt = 7 7 cnt id = 1 1 id
K = int(input())
id = 1
cnt = 7
while cnt < K:
    cnt = cnt * 10 + 7
    id += 1

visited = [0] * K
while True:
    remz = (cnt % K)
    if remz == 0:
        break
    visited[remz] += 1
    if visited[remz] > 1:
        id = -1
        break
    cnt = remz * 10 + 7
    id += 1

print(id)
