# -*- coding: utf-8 -*-
import sys


def main():
    K = int( sys.stdin.readline() )
 
    A = 7

    for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
    print(-1)


if __name__ == "__main__":
    main() import sys sys def main():
    K = int( sys.stdin.readline() )
 
    A = 7

    for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
    print(-1) main K = int( sys.stdin.readline() ) K int( sys.stdin.readline() ) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline A = 7 A 7 for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
     i range(K) range K if A % K == 0:
            print(i+1)
            return

         A % K == 0 A % K A K 0 print(i+1) print i+1 i 1 return A = (A * 10) + 7 A (A * 10) + 7 A * 10 A 10 7 A %= K A K print(-1) print -1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    K = int( sys.stdin.readline() )
 
    A = 7

    for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
    print(-1) def main():
    K = int( sys.stdin.readline() )
 
    A = 7

    for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
    print(-1) main
# -*- coding: utf-8 -*-
import sys


def main():
    K = int( sys.stdin.readline() )
 
    A = 7

    for i in range(K):
        if A % K == 0:
            print(i+1)
            return

        A = (A * 10) + 7
        A %= K
    
    print(-1)


if __name__ == "__main__":
    main()
