#include <bits/stdc++.h>
using namespace std;
bool pal(string s) {
  string b = s;
  reverse(b.begin(), b.end());
  return b == s;
}
int main() {
  string s;
  cin >> s;
  for (int i = 0; i <= s.size(); ++i) {
    for (char a = 'a'; a <= 'z'; ++a) {
      string b = s.substr(0, i) + a + s.substr(i);
      if (pal(b)) {
        cout << b << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
