#!/usr/bin/env python
# -*- coding: utf-8 -*-

k = int(input())

n = 0
for i in range(1, k + 1):
	n = (10 * n + 7) % k
	if n == 0:
		print(i)
		break
else:
	print(-1) k = int(input()) k int(input()) int input() input n = 0 n 0 for i in range(1, k + 1):
	n = (10 * n + 7) % k
	if n == 0:
		print(i)
		break
else:
	print(-1) i range(1, k + 1) range 1 k + 1 k 1 n = (10 * n + 7) % k n (10 * n + 7) % k 10 * n + 7 10 * n 10 n 7 k if n == 0:
		print(i)
		break n == 0 n 0 print(i) print i break print(-1) print -1 n = (10 * n + 7) % k (10 * n + 7) % k n n = 0 0 n k = int(input()) int(input()) k
#!/usr/bin/env python
# -*- coding: utf-8 -*-

k = int(input())

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