Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

H_KITTY - Hello Kitty (challenge)

Kitty sends a kind of original email messages to her friend Garf. To write a message, she chooses a word W and a number n and replicates W n times horizontally. Then she repeats this string in the next line, but rotating the characters once to the left. And she repeats this 'rotate-and-output' process until the word W appears displayed as the rst column of the rectangular pattern that she produces.
As an example, when she chooses the word Hello and the number 3, she gets the pattern:


HelloHelloHello
elloHelloHelloH
lloHelloHelloHe
loHelloHelloHel
oHelloHelloHell


Kitty has been sending such emails during the last three years. Recently, Garf told her that perhaps her work may be automatized with a software to produce Kitty's patterns. Could you help her?

Input

The input le contains several test cases, each one of them in a separate line. Each test case has a word and a positive integer that should generate the corresponding rectangular pattern. The word is a string of alphabetic characters (a..z), (A..Z). The number is less than 10. A line whose contents is a single period character means the end of the input (this last line is not to be processed).

Output

Output texts for each input case are presented in the same order that input is read. For each test case the answer must be a left aligned Kitty pattern corresponding to the input.

Example

Input:
Love 1
Kitty 2
.

Output:
Love
oveL
veLo
eLov
KittyKitty
ittyKittyK
ttyKittyKi
tyKittyKit
yKittyKitt


Added by:Piotr Kąkol
Date:2010-03-27
Time limit:3.983s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi
Resource:Copy of Daniel Gómez Didier's task Hello Kitty with different judge

hide comments
2010-04-01 21:29:09 Zoltán Zámbori
Something is wrong with the test cases. I wrote a shorter solution in C but i cant post it because "time limit exceeded".

Nobody can send the shortest possible solution if there are time limits because of unnatural huge test cases. :-(
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.