#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < (n + 1); i++) {
    for (char j = 'a'; j <= 'z'; j++) {
      string x, y;
      x = s.substr(0, i) + j + s.substr(i);
      y = x;
      reverse(x.begin(), x.end());
      if (x == y) {
        cout << x << endl;
        return;
      }
    }
  }
  cout << "NA" << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  solve();
}
