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