#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  string s1;
  bool flag = false;
  for (int i = 0; i <= s.size(); ++i) {
    for (char c = 'a'; c <= 'z'; ++c) {
      string t;
      t += c;
      s1 = s;
      s1.insert(i, t);
      string s2 = s1;
      reverse(s2.begin(), s2.end());
      if (s2 == s1) {
        cout << s2 << endl;
        flag = true;
        exit(0);
      }
    }
  }
  if (!flag) {
    cout << "NA" << endl;
  }
  return 0;
}
