def main():
    K = int(input())
    v = 7 % K
    for i in range(K+5):
        if v == 0:
            print(i+1)
            return
        v = v * 10 + 7
        v %= K
    print(-1)


if __name__ == '__main__':
    main() def main():
    K = int(input())
    v = 7 % K
    for i in range(K+5):
        if v == 0:
            print(i+1)
            return
        v = v * 10 + 7
        v %= K
    print(-1) main K = int(input()) K int(input()) int input() input v = 7 % K v 7 % K 7 K for i in range(K+5):
        if v == 0:
            print(i+1)
            return
        v = v * 10 + 7
        v %= K
     i range(K+5) range K+5 K 5 if v == 0:
            print(i+1)
            return
         v == 0 v 0 print(i+1) print i+1 i 1 return v = v * 10 + 7 v v * 10 + 7 v * 10 v 10 7 v %= K v K print(-1) print -1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    K = int(input())
    v = 7 % K
    for i in range(K+5):
        if v == 0:
            print(i+1)
            return
        v = v * 10 + 7
        v %= K
    print(-1) def main():
    K = int(input())
    v = 7 % K
    for i in range(K+5):
        if v == 0:
            print(i+1)
            return
        v = v * 10 + 7
        v %= K
    print(-1) main
def main():
    K = int(input())
    v = 7 % K
    for i in range(K+5):
        if v == 0:
            print(i+1)
            return
        v = v * 10 + 7
        v %= K
    print(-1)


if __name__ == '__main__':
    main()
