#include <bits/stdc++.h>
using namespace std;
string s;
bool judge(string c) {
  int len = c.size();
  for (int i = 0; i < len; i++) {
    if (c[i] != c[len - 1 - i]) return false;
  }
  return true;
}
int main() {
  string c;
  int k;
  cin >> s;
  int len = s.size();
  for (int i = 0; i <= len; i++) {
    for (int j = 0; j < 26; j++) {
      c.clear();
      for (k = 0; k < i; k++) c.push_back(s[k]);
      c.push_back(j + 'a');
      for (; k < len; k++) c.push_back(s[k]);
      if (judge(c)) {
        cout << c;
        return 0;
      }
    }
  }
  puts("NA");
}
