suma
Costel really likes Math and he especially likes positive integers that have a lot of digits. When he gets bored, Costel invents all kinds of "tricks" using positive integers. The last time, Costel wondered if there are any positive integers that have N digits which have the sum of their digits equal to N. For N=6 Costel found 111111, 201201, 103011 and many others.
Task
Write a program that determines, for a given N, the smallest and the biggest positive integer of N digits, that has the property that the sum of its digits is equal to N.
Input Data
Input file suma.in contains a single line with positive integer N.
Output Data
File suma.out will contain two lines. Line one will contain the smallest number of N digits that has the sum of its digits equal to N, and the second line will contain the biggest positive integer of N digits that has the sum of its digits equal to N.
Constraints
1<= N <= 1000
Examples
suma.in |
suma.out | suma.in |
suma.out |
6 |
100005 600000 |
11 | 10000000019 92000000000
|
Time limit: 0.1 seconds/test
prof. Alin Burta
"B.P. Haşdeu" Buzău National High School
Contact: allbu2003@yahoo.com