K = int(input())
ans = -1
keep = 0
check = 7
for i in range(K):
    keep = (keep + check) % K
    if keep == 0:
        ans = i + 1
        break
    check = (check * 10) % K
print(ans) K = int(input()) K int(input()) int input() input ans = -1 ans -1 keep = 0 keep 0 check = 7 check 7 for i in range(K):
    keep = (keep + check) % K
    if keep == 0:
        ans = i + 1
        break
    check = (check * 10) % K i range(K) range K keep = (keep + check) % K keep (keep + check) % K keep + check keep check K if keep == 0:
        ans = i + 1
        break
     keep == 0 keep 0 ans = i + 1 ans i + 1 i 1 break check = (check * 10) % K check (check * 10) % K check * 10 check 10 K print(ans) print ans check = 7 7 check ans = -1 -1 ans check = (check * 10) % K (check * 10) % K check ans = i + 1 i + 1 ans K = int(input()) int(input()) K keep = 0 0 keep keep = (keep + check) % K (keep + check) % K keep
K = int(input())
ans = -1
keep = 0
check = 7
for i in range(K):
    keep = (keep + check) % K
    if keep == 0:
        ans = i + 1
        break
    check = (check * 10) % K
print(ans)