#!/usr/bin/env python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def gen_cand(S): L = 0 R = len(S) - 1 while True: if L == R: yield (L, S[L]) break if R == L - 1: yield (L, 'a') break if S[L] != S[R]: yield (L, S[R]) yield (R + 1, S[L]) break else: L += 1 R -= 1 S = list(read().rstrip().decode()) for i, x in gen_cand(S): T = S[:] T.insert(i, x) word = ''.join(T) if word == word[::-1]: print(word) exit() print('NA')