import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

k=int(input())
if k%2==0:
    print("-1")
    sys.exit()

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

if not flg:
    print(-1) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline '''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)''' k=int(input()) k int(input()) int input() input if k%2==0:
    print("-1")
    sys.exit() k%2==0 k%2 k 2 0 print("-1") print "-1" sys.exit() sys.exit sys exit flg=False flg False cnt=0 cnt 0 a=7 a 7 for i in range(k):
    cnt+=1
    a%=k
    if a%k==0:
        print(cnt)
        sys.exit()
    a*=10
    a+=7 i range(k) range k cnt+=1 cnt 1 a%=k a k if a%k==0:
        print(cnt)
        sys.exit()
     a%k==0 a%k a k 0 print(cnt) print cnt sys.exit() sys.exit sys exit a*=10 a 10 a+=7 a 7 if not flg:
    print(-1) not flg flg print(-1) print -1 a%=k k a k=int(input()) int(input()) k cnt+=1 1 cnt input = sys.stdin.readline sys.stdin.readline input a*=10 10 a cnt=0 0 cnt a+=7 7 a flg=False False flg a=7 7 a
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

k=int(input())
if k%2==0:
    print("-1")
    sys.exit()

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

if not flg:
    print(-1)