#include <bits/stdc++.h>
//#define int long long
#define double long double
#define fi first
#define se second
#define endl "\n"
#define ii pair<int,int>
#define iii pair<ii,int>
using namespace std;
const int mod=998244353;
const int N=1e6+5;
bool nt(int n){
for (int i=2; i<=sqrt(n); ++i){
if (n%i==0) return false;
}
return true;
}
signed main(){
cin.tie(0) -> sync_with_stdio(false);
freopen("BAI1.INP","r",stdin);
freopen("BAI1.OUT","w",stdout);
string s; cin >> s;
for (int i=0; i<s.size(); ++i){
if (!isdigit(s[i])) s[i]=' ';
}
stringstream ss(s);
int ans=0;
while (ss >> s){
if (s.size()>7) continue;
else {
int n=stoi(s);
if (nt(n)) ans=max(ans,n);
}
}
cout << ans;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Ci8vI2RlZmluZSBpbnQgbG9uZyBsb25nCiNkZWZpbmUgZG91YmxlIGxvbmcgZG91YmxlCiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBlbmRsICJcbiIKI2RlZmluZSBpaSBwYWlyPGludCxpbnQ+CiNkZWZpbmUgaWlpIHBhaXI8aWksaW50Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgbW9kPTk5ODI0NDM1MzsKY29uc3QgaW50IE49MWU2KzU7CmJvb2wgbnQoaW50IG4pewoJZm9yIChpbnQgaT0yOyBpPD1zcXJ0KG4pOyArK2kpewoJCWlmIChuJWk9PTApIHJldHVybiBmYWxzZTsKCX0KCXJldHVybiB0cnVlOwp9CnNpZ25lZCBtYWluKCl7CgljaW4udGllKDApICAtPiBzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwoJZnJlb3BlbigiQkFJMS5JTlAiLCJyIixzdGRpbik7CglmcmVvcGVuKCJCQUkxLk9VVCIsInciLHN0ZG91dCk7CglzdHJpbmcgczsgY2luID4+IHM7Cglmb3IgKGludCBpPTA7IGk8cy5zaXplKCk7ICsraSl7CgkJaWYgKCFpc2RpZ2l0KHNbaV0pKSBzW2ldPScgJzsKCX0KCXN0cmluZ3N0cmVhbSBzcyhzKTsKCWludCBhbnM9MDsKCXdoaWxlIChzcyA+PiBzKXsKCQlpZiAocy5zaXplKCk+NykgY29udGludWU7CgkJZWxzZSB7CgkJCWludCBuPXN0b2kocyk7CgkJCWlmIChudChuKSkgYW5zPW1heChhbnMsbik7CgkJfQoJfQoJY291dCA8PCBhbnM7CglyZXR1cm4gMDsgCn0K