#include <bits/stdc++.h>
using namespace std;

int main() {
	long long n, l = 0, ans = 0;
	cin >> n;
	if(n%2==0||n%5==0)cout << "-1\n";
	else{
		do{
			l*=10;l+=7;l%=n;ans++;
		}while(l!=0);
		cout << ans << '\n';
	}
}