from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k = readInt()

n = 7
for i in range(10**6):
	if n%k==0:
		print(i+1)
		exit()
	else:
		n = (n*10+7)%k

print(-1) from collections import defaultdict from collections import deque from collections import Counter import math math def readInt():
	return int(input()) readInt return int(input()) int(input()) int input() input def readInts():
	return list(map(int, input().split())) readInts return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def readChar():
	return input() readChar return input() input() input def readChars():
	return input().split() readChars return input().split() input().split() ().split () input split k = readInt() k readInt() readInt n = 7 n 7 for i in range(10**6):
	if n%k==0:
		print(i+1)
		exit()
	else:
		n = (n*10+7)%k i range(10**6) range 10**6 10 6 if n%k==0:
		print(i+1)
		exit()
	else:
		n = (n*10+7)%k n%k==0 n%k n k 0 print(i+1) print i+1 i 1 exit() exit n = (n*10+7)%k n (n*10+7)%k n*10+7 n*10 n 10 7 k print(-1) print -1 def readInt():
	return int(input()) def readInt():
	return int(input()) readInt k = readInt() readInt() k def readInts():
	return list(map(int, input().split())) def readInts():
	return list(map(int, input().split())) readInts n = 7 7 n def readChar():
	return input() def readChar():
	return input() readChar def readChars():
	return input().split() def readChars():
	return input().split() readChars n = (n*10+7)%k (n*10+7)%k n
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

k = readInt()

n = 7
for i in range(10**6):
	if n%k==0:
		print(i+1)
		exit()
	else:
		n = (n*10+7)%k

print(-1)