def main():
    K = int(input())
 
    work = 7
 
    answer = -1
    for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
    print(answer)
main() def main():
    K = int(input())
 
    work = 7
 
    answer = -1
    for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
    print(answer) main K = int(input()) K int(input()) int input() input work = 7 work 7 answer = -1 answer -1 for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
     i range(1, K+1) range 1 K+1 K 1 i_mod = work % K i_mod work % K work K if i_mod == 0 :
            answer = i
            break
         i_mod == 0 i_mod 0 answer = i answer i break work = i_mod * 10 + 7 work i_mod * 10 + 7 i_mod * 10 i_mod 10 7 print(answer) print answer main() main def main():
    K = int(input())
 
    work = 7
 
    answer = -1
    for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
    print(answer) def main():
    K = int(input())
 
    work = 7
 
    answer = -1
    for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
    print(answer) main
def main():
    K = int(input())
 
    work = 7
 
    answer = -1
    for i in range(1, K+1):
        i_mod = work % K
        if i_mod == 0 :
            answer = i
            break
        work = i_mod * 10 + 7
    print(answer)
main()