Inscriptio Labyrinthica In the burial place of King Silo of Asturias there is an inscription that reads SILO PRINCEPS FECIT (King Silo made this).



The first letter is found in the very middle, and from there one reads by going in any non-diagonal direction radiating outward.  The final letter is found on all four corners.  In this challenge, you'll generalize the process to make them.

Input

A string (or equivalent), and an integer.  You may make the following assumptions about the input:


The string will have an odd length.
The integer will be an odd number between 1 and one less than twice the length of the string.


Output

An inscriptio labyrinthica for the string, using the integer for the height or width (see models for height examples).  Output should be each letter with no spaces, line break as default to your system/language.

Test cases

Note that an input of 1 or (length * 2 - 1) will result in a horizontal or vertical palindrome.

 Input: FOO, 3    Input: BAR, 1    Input: BAR, 3    Input: BAR, 5

Output: OOO      Output: RABAR    Output: RAR       Output: R
        OFO                               ABA               A
        OOO                               RAR               B
                                                            A
                                                            R

 Input: ABCDE, 5   Input: ABCDE, 3   Input: *&lt;&gt;v^, 5

Output: EDCDE     Output: EDCBCDE           ^v&gt;v^
        DCBCD             DCBABCD           v&gt;&lt;&gt;v
        CBABC             EDCBCDE           &gt;&lt;*&lt;&gt;
        DCBCD                               v&gt;&lt;&gt;v
        EDCDE                               ^v&gt;v^


Scoring

This is code-golf so shortest answer in bytes wins.  Standard loopholes forbidden.
J, 27 bytes

([{~]+/&amp;(|@i:)#@[-1+])-:@&lt;:


Try it online!

An example will clarify the high-level approach.

Consider 'ABCDE' f 3

We notice that what we seek is simply the "cross addition" table of 1 0 1 and 3 2 1 0 1 2 3, which looks like this:

4 3 2 1 2 3 4
3 2 1 0 1 2 3
4 3 2 1 2 3 4


We then pull those indexes from the original string: [{~.

All the rest of the code is just boring arithmetic and the use of i: to construct the arguments 1 0 1 and 3 2 1 0 1 2 3.