import java.util.Scanner;

public class hack {
	public static int size;
	public static int spaceSum;
	public static int moznosti;
	
	public static int size(int n) {
		int i = 0;
		while (n>0) {
			i++;
			n /=10;
		}		
		return i;
	}
	
	public static int moznosti(int n, int size) {
		int result = 1;
		int i;
		for (int j = 0; j < size; j++) {
			result *= 10;
		}
		//System.out.println("base result" + result);
		if (n == 0) {			
			return result - 1;
		}
		while (size > 0) {
			i = n % 10;
			n /= 10;
			size --;
			if (i < 5) {
				result += i;
			} else {
				result += 9 - i;
			}
		}
		return result - 1;		
	}
	
	public static void vypis(int[] pole) {
		int size = pole.length;
		size --;
		for (int i = 0; i <= size; i++) {
			System.out.print(pole[i]);			
		}
	}
	
	public static void vypisuj (int[] pole, int i) {
		if (i == pole.length) return;
		if (pole[i] == 0) {
			while (pole[i] != 9) {
				pole[i] ++;									
				vypis(pole);
				if (spaceSum != moznosti) {
					System.out.print(" ");	
					spaceSum++;			
				}
				vypisuj(pole, i+1);
			}
		} else {
			while (pole[i] != 0) {
				pole[i] --;									
				vypis(pole);		
				if (spaceSum != moznosti) {
					System.out.print(" ");	
					spaceSum++;			
				}	
				vypisuj(pole, i + 1);									
			}
		}		
	}

	
	public static void main (String [] args) {
		int n;
		String line;
		Scanner sc = new Scanner(System.in);
		while (true) {			
			line = sc.next();
			size = line.length();
			//System.out.println(size);
			n = Integer.parseInt(line);
			if (n == -1) {
				return;
			}
			moznosti = moznosti(n, size);
			System.out.println(moznosti);
			int [] pole = new int[size];
			for (int i = 0; i < size; i++) {
				pole[i] = Integer.parseInt("" + line.charAt(i));				
			}
			for (int i = 0; i < size; i++) {
				if (pole[i] < 5) {
					while (pole[i] != 0) {
						pole[i] --;									
						vypis(pole);
						System.out.print(" ");						
					}
				} else {
					while (pole[i] != 9) {
						pole[i] ++;									
						vypis(pole);						
						System.out.print(" ");					
					}
				}
			}
			//mame vynulovane pole
			spaceSum = 0;		
			vypisuj(pole, 0);	
			System.out.println();
		}
	}
}
