#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	int k; scanf("%d", &k);
	for (int i = 1, cur = 7 % k; i <= k; ++i, cur = ((cur * 10) + 7) % k) {
		if (cur == 0) {
			printf("%d\n", i);
			return 0;
		}
	}
	printf("-1\n");
}
