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