#                               #
    # author : samars_diary #
    # 17-09-2020 │ 16:21:14 #
#                               #

import sys, os.path

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii()
    val=7%a
    for i in range(1,10**7):
        if val==0:
            print(i)
            return
        val=(val*10+7)%a
    print(-1)
for _ in range(1):
    solve() import sys, os.path sys os.path sys.setrecursionlimit(10 ** 5) sys.setrecursionlimit sys setrecursionlimit 10 ** 5 10 5 def mod(): return 10**9+7 mod def i(): return sys.stdin.readline().strip() i def ii(): return int(sys.stdin.readline()) ii def li(): return list(sys.stdin.readline().strip()) li def mii(): return map(int, sys.stdin.readline().split()) mii def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write lii def solve():
    a=ii()
    val=7%a
    for i in range(1,10**7):
        if val==0:
            print(i)
            return
        val=(val*10+7)%a
    print(-1) solve a=ii() a ii() ii val=7%a val 7%a 7 a for i in range(1,10**7):
        if val==0:
            print(i)
            return
        val=(val*10+7)%a
     i range(1,10**7) range 1 10**7 10 7 if val==0:
            print(i)
            return
         val==0 val 0 print(i) print i return val=(val*10+7)%a val (val*10+7)%a val*10+7 val*10 val 10 7 a print(-1) print -1 for _ in range(1):
    solve() _ range(1) range 1 solve() solve def i(): return sys.stdin.readline().strip() def i(): return sys.stdin.readline().strip() i def ii(): return int(sys.stdin.readline()) def ii(): return int(sys.stdin.readline()) ii def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write lii def solve():
    a=ii()
    val=7%a
    for i in range(1,10**7):
        if val==0:
            print(i)
            return
        val=(val*10+7)%a
    print(-1) def solve():
    a=ii()
    val=7%a
    for i in range(1,10**7):
        if val==0:
            print(i)
            return
        val=(val*10+7)%a
    print(-1) solve def mod(): return 10**9+7 def mod(): return 10**9+7 mod def li(): return list(sys.stdin.readline().strip()) def li(): return list(sys.stdin.readline().strip()) li def mii(): return map(int, sys.stdin.readline().split()) def mii(): return map(int, sys.stdin.readline().split()) mii
#                               #
    # author : samars_diary #
    # 17-09-2020 │ 16:21:14 #
#                               #

import sys, os.path

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    a=ii()
    val=7%a
    for i in range(1,10**7):
        if val==0:
            print(i)
            return
        val=(val*10+7)%a
    print(-1)
for _ in range(1):
    solve()