#include <bits/stdc++.h>
using namespace std;
int palindrom1(string s) {
  int h = 0;
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] != s[s.size() - i - 1]) {
      h = 1;
      break;
    }
  }
  if (h == 0) {
    return 1;
  }
  return 0;
}
using namespace std;
int main() {
  string s, a, z = "babccbab";
  cin >> s;
  a = s;
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j <= s.size(); j++) {
      string y = "";
      y = 'a' + i;
      a.insert(j, y);
      if (palindrom1(a) == 1) {
        cout << a;
        return 0;
      }
      a = s;
    }
  }
  cout << "NA";
}
