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

    a =7%k
    if a == 0:
        print(1)
        sys.exit()

    for i in range(2,10**7):
        a = (10*a+7) % k
        if a == 0:
            print(i)
            sys.exit()

    print(-1)
    
main() import sys sys def main():
    k = int(input())

    a =7%k
    if a == 0:
        print(1)
        sys.exit()

    for i in range(2,10**7):
        a = (10*a+7) % k
        if a == 0:
            print(i)
            sys.exit()

    print(-1)
     main k = int(input()) k int(input()) int input() input a =7%k a 7%k 7 k if a == 0:
        print(1)
        sys.exit()

     a == 0 a 0 print(1) print 1 sys.exit() sys.exit sys exit for i in range(2,10**7):
        a = (10*a+7) % k
        if a == 0:
            print(i)
            sys.exit()

     i range(2,10**7) range 2 10**7 10 7 a = (10*a+7) % k a (10*a+7) % k 10*a+7 10*a 10 a 7 k if a == 0:
            print(i)
            sys.exit()

     a == 0 a 0 print(i) print i sys.exit() sys.exit sys exit print(-1) print -1 main() main def main():
    k = int(input())

    a =7%k
    if a == 0:
        print(1)
        sys.exit()

    for i in range(2,10**7):
        a = (10*a+7) % k
        if a == 0:
            print(i)
            sys.exit()

    print(-1)
     def main():
    k = int(input())

    a =7%k
    if a == 0:
        print(1)
        sys.exit()

    for i in range(2,10**7):
        a = (10*a+7) % k
        if a == 0:
            print(i)
            sys.exit()

    print(-1)
     main
import sys
def main():
    k = int(input())

    a =7%k
    if a == 0:
        print(1)
        sys.exit()

    for i in range(2,10**7):
        a = (10*a+7) % k
        if a == 0:
            print(i)
            sys.exit()

    print(-1)
    
main()