Problem

1 /5


Encryption - 2

Problem

To encode a message, the following actions are used: the message is written, omitting spaces, into a rectangle of a given height along the columns, and then the lines are read in the given order.
 
1 P R I 
2 R A N 
3 O M G 
4G M 
 
and then, if you choose row order 3, 1, 2, 4, get the encoded message OMGPRIRANGM.
 
It is required to write a program that, given the height of the rectangle and the order in which the lines are read, decodes the given message during encoding.
 
Input
The input contains: in the first line, the height of the rectangle H (2 ≤ H ≤ 10), in the second – the order of reading the lines (numbers are written with a space), in the third – An encoded message that is between 1 and 200 characters long. The encoded message consists of uppercase and lowercase Latin letters  and numbers.
 
Output
The decoded message is written to the output.

Enter Output
4
3 1 2 4
OMGPRIRANGM
PROGRAMMING