#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s2, in;
  cin >> s;
  for (int i = 0; i <= s.size(); ++i)
    for (char c = 'a'; c <= 'z'; ++c) {
      s2 = s;
      in = c;
      s2.insert(i, in);
      if (s2 == string(s2.rbegin(), s2.rend())) {
        cout << s2 << endl;
        return 0;
      }
    }
  cout << "NA" << endl;
  return 0;
}
