cho.sh
Notes
Loading...

Cipher

Time limit

2s

Memory limit

128 MB

Problem

Two people encrypt messages so that others cannot read them. The original string is first written into a table with K columns. Starting from the leftmost column, fill each column from top to bottom; after a column is full, move to the next column on the right.

If the original string is abcdefghijkl and K = 3, the table is filled as follows.

aei
bfj
cgk
dhl

Then the encrypted string is made by reading the table row by row. Read the first row from left to right, the second row from right to left, and continue alternating directions for the remaining rows. The table above produces the encrypted string aeijfbcgklhd.

Given the encrypted string and the number of columns K, restore the original string.

Input

The first line contains the number of columns K. (1 ≤ K ≤ 20)

The second line contains the encrypted string. It consists only of lowercase English letters, its length is at most 200, and its length is a multiple of K.

Output

Print the original string on one line.