#include #define all(vec) vec.begin(),vec.end() using namespace std; typedef long long int ll; typedef pair P; const ll MOD=1000000007; const ll INF=1000000010; const ll LINF=4000000000000000010LL; const int MAX=310; const double EPS=1e-9; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; vector eratosthenes(int n){ vector prime(n,true); prime[0]=false;prime[1]=false; for(int i=2;i<=n;i++){ if(prime[i]){ for(int j=i*2;j<=n;j+=i){ prime[j]=false; } } } return prime; } ll digitsum(ll n){ ll sum=0; while(n>0){ sum+=n%10; n/=10; } if(sum>10)return digitsum(sum); else return sum; } bool s[200010]; int main(){ int k,n;cin>>k>>n; vector f=eratosthenes(n); vector v,v2; for(int i=k;i<=n;i++){ if(f[i]){ v2.push_back(i); v.push_back(digitsum(i)); } } int ma=1; int ans=v[0]; int idx=0; s[v[0]]=true; for(int i=1;i