#include <bits/stdc++.h>   using namespace std;   long long n, x;   vector<string> ans;   long long dec(string s) {     long long ret = 0;     for (long long i = 0; i < s.size(); i++) {       ret = ret * 10 + s[i] - 48;     }     return ret;   }   void add(long long v) {     long long rs = 0;     if (ans.size() == 0) {       string tmp =   ;       while (v > 9) {         tmp =  9  + tmp;         v -= 9;       }       tmp = to_string(v) + tmp;       ans.push_back(tmp);     } else {       string p_s = ans[ans.size() - 1], req = p_s;       long long cnt = 0;       for (long long i = 0; i < req.size(); i++) {         cnt += req[i] - 48;       }       if (cnt < v) {         long long df = v - cnt;         for (long long i = req.size() - 1; i >= 0; i--) {           if (req[i] <  9  && df) {             long long dy =  9  - req[i];             req[i] += min(df, dy);             df -= min(df, dy);             if (!df) {               ans.push_back(req);               return;             }           }         }         while (df >= 9) {           req =  9  + req;           df -= 9;         }         if (v) req = to_string(df) + req;         ans.push_back(req);       } else {         string p_s = ans[ans.size() - 1];         long long idx = -1, sm = 0, tmp_sm = 0;         for (long long i = 0; i < p_s.size(); i++) {           tmp_sm += p_s[i] - 48;           if (v > tmp_sm && p_s[i] <  9 ) {             idx = i;             sm = tmp_sm;           } else if (v < sm)             break;         }         if (idx == -1) {           string p_s =  1 ;           long long sz = ans[ans.size() - 1].size();           for (long long i = 0; i < sz; i++) p_s = p_s +  0 ;           v -= 1;           long long idx = p_s.size() - 1;           while (idx > 0 && v > 0) {             char c = (char)min((long long) 9 , v + 48);             p_s[idx] = c;             idx--, v -= 9;           }           ans.push_back(p_s);         } else {           sm = v - sm - 1;           p_s[idx] += 1;           for (long long j = idx + 1; j < p_s.size(); j++) {             p_s[j] =  0 ;           }           for (long long i = p_s.size() - 1; i > idx; i--) {             if (sm > 0) {               long long dx =  9  - p_s[i];               p_s[i] += min(sm, dx);               sm -= min(sm, dx);             } else               break;           }           ans.push_back(p_s);         }       }     }   }   int main() {     cin >> n;     for (long long i = 0; i < n; i++) {       cin >> x;       add(x);     }     for (long long i = 0; i < ans.size(); i++) cout << ans[i] << endl;     return 0;   }   