public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int n=1000;n<10000;n++) {
int i=n;
int a=i/1000;
int e=10*a;
int b=i/100 -e;
e = 10*(e+b);
int c=i/10 -e;
e = 100*(e+b+c);
int d=i -e;
if(a==d && b==c) {
System.out.println(n);
}
}
}
}