#include<bits/stdc++.h>
using namespace std;
bool is_prime(int k) {
if(k < 2) return 0;
for(int i = 2; i <= sqrt(k); i++)
if(k % i == 0) return 0;
return 1;
}
bool check_prime(int k) {
if(is_prime(k)) return 1;
return 0;
}
bool check_sum_prime(int k) {
int s = 0;
while(k != 0){
s += k % 10;
k /= 10;
}
if(is_prime(s)) return 1;
return 0;
}
bool check_element(int k) {
while(k != 0) {
if(!is_prime(k % 10)) return 0;
k /= 10;
}
return 1;
}
bool check_n(int k, int n) {
int d = 0;
while(k != 0) {
k /= 10;
d++;
}
if(d == n) return 1;
return 0;
}
int main() {
int k, n;
cin >> k >> n;
if(check_n(k, n)) cout << k << " co " << n << " chu so" << endl;
if(check_prime(k)) cout << k << " la so nguyen to" << endl;
if(check_sum_prime(k)) cout << k << " co tong cac chu so la so nguyen to" << endl;
if(check_element(k)) cout << k << " co cac chu so la so nguyen to" << endl;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKYm9vbCBpc19wcmltZShpbnQgaykgewoJaWYoayA8IDIpIHJldHVybiAwOwoJZm9yKGludCBpID0gMjsgaSA8PSBzcXJ0KGspOyBpKyspCgkJaWYoayAlIGkgPT0gMCkgcmV0dXJuIDA7CglyZXR1cm4gMTsKfQpib29sIGNoZWNrX3ByaW1lKGludCBrKSB7CglpZihpc19wcmltZShrKSkgcmV0dXJuIDE7CglyZXR1cm4gMDsKfQpib29sIGNoZWNrX3N1bV9wcmltZShpbnQgaykgewoJaW50ICBzID0gMDsKCXdoaWxlKGsgIT0gMCl7IAoJCXMgKz0gayAlIDEwOyAKCQlrIC89IDEwOwoJfQoJaWYoaXNfcHJpbWUocykpIHJldHVybiAxOwoJcmV0dXJuIDA7Cn0KYm9vbCBjaGVja19lbGVtZW50KGludCBrKSB7Cgl3aGlsZShrICE9IDApIHsKCQlpZighaXNfcHJpbWUoayAlIDEwKSkgcmV0dXJuIDA7CgkJayAvPSAxMDsKCX0KCXJ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