#include <bits/stdc++.h>
using namespace std;
int main() {
  string S, T, RT;
  cin >> S;
  bool OK = 0;
  for (int i = 0; i <= S.size(); i++) {
    for (char ch = 'a'; ch <= 'z'; ch++) {
      T = S.substr(0, i) + ch + S.substr(i);
      RT = T;
      reverse(RT.begin(), RT.end());
      if (T == RT) {
        OK = 1;
        break;
      }
    }
    if (OK) break;
  }
  if (OK) {
    cout << T << endl;
  } else {
    cout << "NA" << endl;
  }
}
