import java.util.*;
public class Main {
    public static void main(String[] args){
        for(int i = 10000; i < 100000; ++i){
            int sum = 0;
            for(int j = 10000; j > 1; j /= 10){
                int a = i/j, b = i%j;
                sum += a*b;
            }
            if(i == sum) System.out.printf("%d ", i);
        }
    }
}