#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (char i = 'a'; i <= 'z'; i++) {
    for (int j = 0; j <= s.length(); j++) {
      int x = 0;
      string a = s;
      string str[1] = {};
      str[0] = i;
      a.insert(j, str[0]);
      for (int l = 0; l < a.length(); l++) {
        if (a[l] != a[a.size() - 1 - l]) {
          x = 1;
        }
      }
      if (x == 0) {
        cout << a;
        return 0;
      }
    }
  }
  cout << "NA";
  return 0;
}
