#include <bits/stdc++.h>
using namespace std;
string s, a, b;
long long t, u;
bool Palindrom(string w) {
  string h = "";
  for (int i = 0; i < w.length(); i++) {
    h = w[i] + h;
  }
  if (h == w) return true;
  return false;
}
int main() {
  string words = "abcdefghijklmnopqrstuvwxyz";
  cin >> s;
  for (int i = 0; i <= s.length(); i++) {
    a = "";
    for (int z = 0; z < 26; z++) {
      a = "";
      for (int j = 0; j <= s.length(); j++) {
        if (j == i) a = a + words[z];
        if (j < s.length()) a = a + s[j];
      }
      if (Palindrom(a)) {
        cout << a;
        return 0;
      }
    }
  }
  cout << "NA";
  return 0;
}
