#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
k = I()
# 0 ~ k-1の値を取る場合がある。
i = 0
value = 7%k
while i < k:
    if value == 0:
        print(i+1)
        exit()
    value = (10*value + 7)%k
    i += 1
print(-1) from fractions import gcd from itertools import combinations,permutations,accumulate, product from collections import deque,defaultdict,Counter import decimal decimal import re re import math math import bisect bisect import heapq heapq import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 INF = float('inf') INF float('inf') float 'inf' from sys import stdin readline = stdin.readline readline stdin.readline stdin readline def readInts():
  return list(map(int,readline().split())) readInts return list(map(int,readline().split())) list(map(int,readline().split())) list map(int,readline().split()) map int readline().split() ().split () readline split def readTuples():
    return tuple(map(int,readline().split())) readTuples return tuple(map(int,readline().split())) tuple(map(int,readline().split())) tuple map(int,readline().split()) map int readline().split() ().split () readline split def I():
    return int(readline()) I return int(readline()) int(readline()) int readline() readline k = I() k I() I i = 0 i 0 value = 7%k value 7%k 7 k while i < k:
    if value == 0:
        print(i+1)
        exit()
    value = (10*value + 7)%k
    i += 1 i < k i k if value == 0:
        print(i+1)
        exit()
     value == 0 value 0 print(i+1) print i+1 i 1 exit() exit value = (10*value + 7)%k value (10*value + 7)%k 10*value + 7 10*value 10 value 7 k i += 1 i 1 print(-1) print -1 def I():
    return int(readline()) def I():
    return int(readline()) I value = 7%k 7%k value INF = float('inf') float('inf') INF mod = 10**9 + 7 10**9 + 7 mod readline = stdin.readline stdin.readline readline k = I() I() k def readInts():
  return list(map(int,readline().split())) def readInts():
  return list(map(int,readline().split())) readInts def readTuples():
    return tuple(map(int,readline().split())) def readTuples():
    return tuple(map(int,readline().split())) readTuples i += 1 1 i value = (10*value + 7)%k (10*value + 7)%k value i = 0 0 i
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
k = I()
# 0 ~ k-1の値を取る場合がある。
i = 0
value = 7%k
while i < k:
    if value == 0:
        print(i+1)
        exit()
    value = (10*value + 7)%k
    i += 1
print(-1)
