Problem D

Vampire Numbers

Input: standard input

Output: standard output

Time Limit: 5 seconds

 

A number v = xy with an even number (n) of digits formed by multiplying a pair of n/2-digit numbers (where the digits are taken from the original number in any order) x and y together is known as vampire number. Pairs of trailing zeros (Both the numbers have a trailing zero) are not allowed. If v is a vampire number then x and y are called its "fangs." Examples of 4-digit vampire numbers include

 

1) 21 x 60 = 1260
2) 15 x 93 = 1395
3) 35 x 41 = 1435
4) 30 x 51 = 1530
5) 21 x 87 = 1827
6) 27 x 81 = 2187
7) 80 x 86 = 6880

 

In this program you will have to find all the 4, 6 and 8 digit even vampire numbers.

 

Input

The input file contains maximum ten lines of input. Each line contains a single integer n whose value is 4, 6 or 8. Input is terminated by end of file.

 

Output

For each input n produce all the n-digit vampire numbers that are even in ascending order. Print a blank line after the output for each set of input.

 

Sample Input:

4

4

 

Sample Output:

1260

1530

6880

 

1260

1530

6880

 


(Problem Setter: Shahriar Manzoor, CSE Dept, Southeast University, Dhaka)

 

Only the fool people reach their goals and stop. Those who are intelligent always

keep uplifting their goals and thus advance forward till death.