import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    k = I()
    ans = -1
    s = 7%k
    if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
    print(ans)

main()             import bisect,collections,copy,itertools,math,string bisect collections copy itertools math string import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS def main():
    k = I()
    ans = -1
    s = 7%k
    if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
    print(ans) main k = I() k I() I ans = -1 ans -1 s = 7%k s 7%k 7 k if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
     s==0 s 0 ans = 1 ans 1 for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
     i range(1,k) range 1 k s = (s*10+7)%k s (s*10+7)%k s*10+7 s*10 s 10 7 k if s == 0:
                ans = i+1
                break
     s == 0 s 0 ans = i+1 ans i+1 i 1 break print(ans) print ans main() main def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S def main():
    k = I()
    ans = -1
    s = 7%k
    if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
    print(ans) def main():
    k = I()
    ans = -1
    s = 7%k
    if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
    print(ans) main def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    k = I()
    ans = -1
    s = 7%k
    if s==0:
        ans = 1
    else:
        for i in range(1,k):
            s = (s*10+7)%k
            if s == 0:
                ans = i+1
                break
    print(ans)

main()            
