import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    k = ni()
    c = 0
    for i in range(k):
        c = (c * 10 + 7) % k
        if c == 0:
            print(i+1)
            break
    else:
        print(-1)
    return

solve() import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readall = sys.stdin.read readall sys.stdin.read sys.stdin sys stdin read ns = lambda: readline().rstrip() ns lambda: readline().rstrip() readline().rstrip() ().rstrip () readline rstrip ni = lambda: int(readline().rstrip()) ni lambda: int(readline().rstrip()) int(readline().rstrip()) int readline().rstrip() ().rstrip () readline rstrip nm = lambda: map(int, readline().split()) nm lambda: map(int, readline().split()) map(int, readline().split()) map int readline().split() ().split () readline split nl = lambda: list(map(int, readline().split())) nl lambda: list(map(int, readline().split())) list(map(int, readline().split())) list map(int, readline().split()) map int readline().split() ().split () readline split prn = lambda x: print(*x, sep='\n') prn lambda x: print(*x, sep='\n') print(*x, sep='\n') print *x x sep='\n' sep '\n' x def solve():
    k = ni()
    c = 0
    for i in range(k):
        c = (c * 10 + 7) % k
        if c == 0:
            print(i+1)
            break
    else:
        print(-1)
    return solve k = ni() k ni() ni c = 0 c 0 for i in range(k):
        c = (c * 10 + 7) % k
        if c == 0:
            print(i+1)
            break
    else:
        print(-1)
     i range(k) range k c = (c * 10 + 7) % k c (c * 10 + 7) % k c * 10 + 7 c * 10 c 10 7 k if c == 0:
            print(i+1)
            break
     c == 0 c 0 print(i+1) print i+1 i 1 break print(-1) print -1 return solve() solve ni = lambda: int(readline().rstrip()) lambda: int(readline().rstrip()) ni readline = sys.stdin.readline sys.stdin.readline readline nl = lambda: list(map(int, readline().split())) lambda: list(map(int, readline().split())) nl def solve():
    k = ni()
    c = 0
    for i in range(k):
        c = (c * 10 + 7) % k
        if c == 0:
            print(i+1)
            break
    else:
        print(-1)
    return def solve():
    k = ni()
    c = 0
    for i in range(k):
        c = (c * 10 + 7) % k
        if c == 0:
            print(i+1)
            break
    else:
        print(-1)
    return solve readall = sys.stdin.read sys.stdin.read readall ns = lambda: readline().rstrip() lambda: readline().rstrip() ns nm = lambda: map(int, readline().split()) lambda: map(int, readline().split()) nm prn = lambda x: print(*x, sep='\n') lambda x: print(*x, sep='\n') prn
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    k = ni()
    c = 0
    for i in range(k):
        c = (c * 10 + 7) % k
        if c == 0:
            print(i+1)
            break
    else:
        print(-1)
    return

solve()
