#include<iostream> using namespace std; int data[100005]; int main(){ int j,a[5],temp; for(int i=1;i<=100000;i++){ j = i; temp = i; while(j>0){ temp += j%10; j /= 10; } if(data[temp]==0){ data[temp] = i; } } while(scanf("%d",&temp)==1){ printf("%d\n",data[temp]); } return 0; }