#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  int l, cnt = 0;
  cin >> s;
  l = s.length();
  for (int k = 0; k <= l; k++)
    for (char n = 'a'; n <= 'z'; n++) {
      string t = s, p = " ";
      p[0] = n;
      t.insert(k, p);
      cnt = 0;
      int i = t.size() - 1;
      for (int x = 0; x <= t.size() / 2; x++) {
        if (t[x] != t[i]) cnt++;
        i--;
      }
      if (cnt == 0) {
        cout << t;
        return 0;
      }
    }
  cout << "NA";
  return 0;
}
