def main():
    k=int(input())
    s=7
    for i in range(10**6):
        if s%k == 0:
            print(i+1)
            break
        s = (s*10+7)%k
    else:
        print(-1)

if __name__ == "__main__":
    main() def main():
    k=int(input())
    s=7
    for i in range(10**6):
        if s%k == 0:
            print(i+1)
            break
        s = (s*10+7)%k
    else:
        print(-1) main k=int(input()) k int(input()) int input() input s=7 s 7 for i in range(10**6):
        if s%k == 0:
            print(i+1)
            break
        s = (s*10+7)%k
    else:
        print(-1) i range(10**6) range 10**6 10 6 if s%k == 0:
            print(i+1)
            break
         s%k == 0 s%k s k 0 print(i+1) print i+1 i 1 break s = (s*10+7)%k s (s*10+7)%k s*10+7 s*10 s 10 7 k print(-1) print -1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    k=int(input())
    s=7
    for i in range(10**6):
        if s%k == 0:
            print(i+1)
            break
        s = (s*10+7)%k
    else:
        print(-1) def main():
    k=int(input())
    s=7
    for i in range(10**6):
        if s%k == 0:
            print(i+1)
            break
        s = (s*10+7)%k
    else:
        print(-1) main
def main():
    k=int(input())
    s=7
    for i in range(10**6):
        if s%k == 0:
            print(i+1)
            break
        s = (s*10+7)%k
    else:
        print(-1)

if __name__ == "__main__":
    main()