Leading and Trailing

Apart from the novice programmers, all others know that you can’t exactly represent numbers raised to some high power. For example, the C function pow(125456, 455) can be represented in double data type format, but you won’t get all the digits of the result. However we can get at least some satisfaction if we could know few of the leading and trailing digits. This is the requirement of this problem. Input The first line of input will be an integer T < 1001, where T represents the number of test cases. Each of the next T lines contains two positive integers, n and k. n will fit in 32 bit integer and k will be less than 10000001. Output For each line of input there will be one line of output. It will be of the format LLL...TTT, where LLL represents the first three digits of nk and TTT represents the last three digits of nk. You are assured that nk will contain at least 6 digits. Sample Input 2 123456 1 123456 2 Sample Output 123...456 152...936