package introductory;
import java.util.Scanner;
/*
123321是一个非常特殊的数,它从左边读和从右边读是一样的。
输入一个正整数n, 编程求所有这样的五位和六位十进制数,满足各位数字之和等于n 。
*/
public class test05 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.close();
for(int m = 10000; m<=99999; m++){
int a = m%10;
int b = m/10%10;
int c = m/100%10;
int d = m/1000%10;
int e = m/10000;
if( a == e && b == d && a+b+c+d+e == n){
System.out.println(m);
}
}
for(int m = 100000; m<=999999; m++){
int a = m%10;
int b = m/10%10;
int c = m/100%10;
int d = m/1000%10;
int e = m/10000%10;
int f = m/100000;
if( a == f && b == e && c == d && a+b+c+d+e+f == n){
System.out.println(m);
}
}
}
}