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