#include <bits/stdc++.h>
using namespace std;
int main() {
  bool c = false;
  string s, s1;
  string s2;
  cin >> s;
  s2 = s;
  for (int i = 0; i < 26; i++) {
    for (int k = 0; k < s.size() + 1; k++) {
      s.insert(k, 1, 'a' + i);
      s1 = s;
      reverse(s.begin(), s.end());
      if (s == s1) {
        c = true;
        cout << s << endl;
        break;
      }
      s = s2;
    }
    if (c == true) break;
  }
  if (c == false) cout << "NA" << endl;
}
