#include <bits/stdc++.h>
using namespace std;
string a, b, c;
char ch;
int i;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (cin >> a, ch = 'a'; ch <= 'z'; ++ch) {
    for (i = 0; i <= a.size(); ++i) {
      b = a;
      b.insert(b.begin() + i, ch);
      c = b;
      reverse(c.begin(), c.end());
      if (c == b) {
        cout << c << endl;
        return 0;
      }
    }
  }
  cout << "NA" << endl;
  return 0;
}
