Smooth numbers
시간 제한2초메모리 제한1024 MB
자릿수 l(최대 100)이 주어질 때, 양 끝을 제외한 모든 자릿수가 양옆 자릿수의 평균보다 작은 l자리 수 중 가장 큰 수를 구하거나, 없으면 -1을 출력합니다.
문제
Let's call positive integer smooth if each of its digits except the first and the last is less then the average of it's two neighbor digits. It means that if then for each the inequality holds.
Vasya has been studying smooth numbers for a long time and he wants to know, if any smooth number of exactly digits exists, and if so, what is the greatest -digit smooth number.
Vasya is asking you for help! Find the greatest -digit smooth number.
출력
Input file contains the only integer () --- number of digits in smooth number.
제한
Output the greatest -digit smooth number or if it does not exist.