<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Given a string and an integer N, write a Python function to construct the Nth palindromic string.
<|im_end|>
<|im_start|>assistant
def construct_palindrome(string, N):
    length = len(string)
    mid = length // 2

    left = string[:mid]
    right = left[::-1]

    if length % 2 == 0:
        left = string[:mid - (N - 1)]
        right = left[::-1]
    else:
        left = string[:mid - N]
        right = string[mid + 1:(mid + 1) + N][::-1]

    return left + string[mid] + right<|im_end|>
