#include using namespace std; int main() { string s; cin >> s; int n = s.length(); for (int i = 0; i < n / 2; i++) { if (s[i] == s[n - 1 - i]) continue; { string t = s.substr(0, n - i) + s[i] + s.substr(n - i); int m = t.length(); for (int j = 0; j < m / 2; j++) { if (t[j] != t[m - 1 - j]) break; if (j == m / 2 - 1) { cout << t << endl; return 0; } } } { string t = s.substr(0, i) + s[n - 1 - i] + s.substr(i); int m = t.length(); for (int j = 0; j < m / 2; j++) { if (t[j] != t[m - 1 - j]) break; if (j == m / 2 - 1) { cout << t << endl; return 0; } } } cout << "NA" << endl; return 0; } if (n % 2 == 0) { string t = s.substr(0, n / 2) + 'a' + s.substr(n / 2); cout << t << endl; } else { string t = s.substr(0, n / 2) + s[n / 2] + s.substr(n / 2); cout << t << endl; } }