#include <bits/stdc++.h>
using namespace std;
inline double Time() { return ((clock() * 1.0) / CLOCKS_PER_SEC); }
const int N = 100500;
string s;
bool check(string x) {
  for (int i = 0, j = x.size() - 1; i < x.size(), j >= 0; i++, j--) {
    if (x[i] != x[j]) {
      return false;
    }
  }
  return true;
}
int main() {
  srand(time(NULL));
  cin >> s;
  for (int i = 0; i < s.size() + 1; i++) {
    for (char j = ('a'); j <= ('z'); j++) {
      string rec = "";
      for (int k = 0; k < i; k++) {
        rec += s[k];
      }
      rec += j;
      for (int k = i; k < s.size(); k++) {
        rec += s[k];
      }
      if (check(rec)) {
        cout << rec;
        return 0;
      }
    }
  }
  cout << "NA";
  return 0;
}
