#include <bits/stdc++.h>
using namespace std;
vector<char> v;
string s;
bool check(char a, int b) {
  while (v.size() > 0) v.pop_back();
  for (int i = 0; i < b; i++) v.push_back(s[i]);
  v.push_back(a);
  for (int i = b; i < s.size(); i++) v.push_back(s[i]);
  int y = 0;
  int u = s.size();
  while (y <= u) {
    if (v[y] != v[u]) return 0;
    y++;
    u--;
  }
  return 1;
}
int main() {
  char b;
  cin >> s;
  bool mark = 0;
  for (int i = 0; i <= s.size(); i++) {
    for (int j = 97; j <= 122; j++) {
      b = j;
      if (check(b, i)) {
        for (int p = 0; p < v.size(); p++) cout << v[p];
        mark = 1;
        break;
      }
    }
    if (mark) break;
  }
  if (!mark) cout << "NA";
}
