#include <bits/stdc++.h>   using namespace std;   int getsum(string st) {     int rest = 0;     for (int i = 0; i < st.size(); i++) {       rest += st[i] -  0 ;     }     return rest;   }   string streverse(string st) {     for (int i = 0; i < st.size() / 2; i++) {       char tmp = st[i];       st[i] = st[st.size() - 1 - i];       st[st.size() - 1 - i] = tmp;     }     return st;   }   string getGreater(int a, int num, string st) {     int increase = a - num;     for (int i = st.size() - 1; i >= 0; i--) {       if (st[i] -  0  < 9) {         int increment = min(9 - (st[i] -  0 ), increase);         st[i] += increment;         increase -= increment;       }       if (increase == 0) return st;     }     string rest =   ;     for (int i = 0; i < a / 9; i++) rest = rest +  9 ;     if (a % 9 > 0) {       rest = rest + (char)( 0  + a % 9);     }     return streverse(rest);   }   string getLess(int a, int num, string st) {     int decrease = num - a;     decrease++;     int sum = 0;     for (int i = st.size() - 1; i >= 1; i--) {       sum += st[i] -  0 ;       if (sum >= decrease) {         if (st[i - 1] -  0  < 9) {           st[i - 1]++;           sum = sum - decrease;           for (int j = i; j < st.size(); j++) st[j] =  0 ;           int indx = st.size() - 1;           while (sum > 0) {             if (sum > 9) {               st[indx] += 9;               sum -= 9;             } else {               st[indx] += sum;               sum = 0;             }             indx--;           }           return st;         }       }     }     st =  1  + st;     for (int i = 1; i < st.size(); i++) {       st[i] =  0 ;     }     a--;     int k;     for (k = 0; k < a / 9; k++) {       st[st.size() - 1 - k] =  9 ;     }     if (a % 9) {       for (int i = st.size() - 1; i >= 0; i--) {         if (st[i] ==  0 ) {           st[i] = (char)( 0  + a % 9);           break;         }       }     }     return st;   }   string getnum(int a, string st) {     int num = getsum(st);     if (a > num) {       return getGreater(a, num, st);     }     return getLess(a, num, st);   }   int main() {     getnum(13,  1093 );     int n;     cin >> n;     string pre =   ;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       string rest = getnum(a, pre);       cout << rest << endl;       pre = rest;     }     return 0;   }   