#include #include using namespace std; int S1(int k) { return k/10; } int S2(int k) { int d; if(k<2)return 0; for(d=2;d<=k/2;d++) if(k%d==0) return 0; return 1; } int main() { int x; ifstream f("date.in"); while(f>>x) { while(S2(x)==0 && x>0) x=S1(x); cout<