시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 1024 MB82228.571%

문제

Dan likes playing with his pocket calculator during those long, boring math classes. Just now the teacher started to talk about the factorial function.

N factorial, denoted by N!, is the product of all the integers between 1 and N, inclusive. For example 6! = 6*5*4*3*2*1 = 720.

Dan took out his calculator out of his pocket to play around with this new function. Unfortunately his calculator quickly ran out of digits and only showed overflow errors. Soon, Dan realized that the factorial function grows very quickly. Still, he would like to know at least some of its digits.

Given three positive integers N, K, L, compute the first K digits and the last L digits of N factorial.

입력

The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line.

Each test case consists of one line containing three positive integers N, K and L separated by single spaces. Neither K nor L will exceed the number of digits in N!.

출력

For each test case output one line containing two strings A and B separated by a single space. Here, A is the string composed of the first K digits of N! and B is the string composed of the last L digits of N!.

제한

  • 1 ≤ T ≤ 101

Easy (1점)

  • 1 ≤ N ≤ 99
  • 1 ≤ K ≤ 40
  • 1 ≤ L ≤ 39

Hard (2점)

  • 1 ≤ N ≤ 99506247
  • 1 ≤ K ≤ 15
  • 1 ≤ L ≤ 250

예제 입력 1

3

6 2 1

10 3 2

8 5 5

예제 출력 1

72 0
362 00
40320 40320

채점 및 기타 정보

  • 예제는 채점하지 않는다.