def main():
    k = int(input())

    if k % 2 ==0:
        print(-1)
        return
    last = 0
    for i in range(1000000):
        if (last*10 + 7) % k == 0:
            print(i+1)
            return
        last = (last*10 + 7) % k
    print(-1)


if __name__ == '__main__':
    main() def main():
    k = int(input())

    if k % 2 ==0:
        print(-1)
        return
    last = 0
    for i in range(1000000):
        if (last*10 + 7) % k == 0:
            print(i+1)
            return
        last = (last*10 + 7) % k
    print(-1) main k = int(input()) k int(input()) int input() input if k % 2 ==0:
        print(-1)
        return
     k % 2 ==0 k % 2 k 2 0 print(-1) print -1 return last = 0 last 0 for i in range(1000000):
        if (last*10 + 7) % k == 0:
            print(i+1)
            return
        last = (last*10 + 7) % k
     i range(1000000) range 1000000 if (last*10 + 7) % k == 0:
            print(i+1)
            return
         (last*10 + 7) % k == 0 (last*10 + 7) % k last*10 + 7 last*10 last 10 7 k 0 print(i+1) print i+1 i 1 return last = (last*10 + 7) % k last (last*10 + 7) % k last*10 + 7 last*10 last 10 7 k print(-1) print -1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    k = int(input())

    if k % 2 ==0:
        print(-1)
        return
    last = 0
    for i in range(1000000):
        if (last*10 + 7) % k == 0:
            print(i+1)
            return
        last = (last*10 + 7) % k
    print(-1) def main():
    k = int(input())

    if k % 2 ==0:
        print(-1)
        return
    last = 0
    for i in range(1000000):
        if (last*10 + 7) % k == 0:
            print(i+1)
            return
        last = (last*10 + 7) % k
    print(-1) main
def main():
    k = int(input())

    if k % 2 ==0:
        print(-1)
        return
    last = 0
    for i in range(1000000):
        if (last*10 + 7) % k == 0:
            print(i+1)
            return
        last = (last*10 + 7) % k
    print(-1)


if __name__ == '__main__':
    main()
