n=input()exec'n=abs(n-int(`n`[::-1]));'*nprint n
1584
6534
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!