#include <bits/stdc++.h>
using namespace std;
const long long inf = 10000000000000001;
long long n, m, k = 0, q;
string s;
int frq[12];
int main() {
  cin >> s;
  n = s.length();
  for (int i = 0; i < n; i++) {
    frq[s[i] - '1']++;
  }
  if (frq[3] && frq[6]) {
    if (frq[3] == frq[6] || frq[3] > frq[6])
      cout << "4";
    else
      cout << "7";
  } else if (frq[3])
    cout << "4";
  else if (frq[6])
    cout << "7";
  else
    cout << "-1";
  return 0;
}
