#include<map>
#include<set>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<cstdio>
#include<cctype>
#include<string>
#include<vector>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<functional>
#define fuck(x) cout<<"["<<x<<"]"
#define FIN freopen("input.txt","r",stdin)
#define FOUT freopen("output.txt","w+",stdout)
using namespace std;
typedef long long LL;
typedef pair<int, int>PII;

const int MX = 1e5 + 5;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int A[MX], B[MX];
int minlen(int x) {
    return (x - 1) / 9 + 1;
}
int getmin(int A[], int len, int x) {
    if(x - (len - 1) * 9 > 0) A[1] = x - (len - 1) * 9;
    else A[1] = 1, x--;
    for(int i = len; i >= 2; i--) {
        A[i] = min(x, 9);
        x -= A[i];
    }
    return len;
}
void getmax(int A[], int len, int x) {
    for(int i = 1; i <= len; i++) {
        A[i] = min(x, 9);
        x -= A[i];
    }
}
bool isok(int A[], int len, int x) {
    getmax(B, len, x);
    for(int i = 1; i <= len; i++) {
        if(A[i] < B[i]) return true;
        if(A[i] > B[i]) return false;
    }
    return false;
}

int main() {
    int n, x; //FIN;
    while(~scanf("%d", &n)) {
        int len, last, now;
        for(int i = 1; i <= n; i++) {
            scanf("%d", &x); now = x;
            if(i == 1) {
                len = getmin(A, minlen(x), x);
            } else {
                int l = minlen(x);
                if(l > len) len = getmin(A, l, x);
                else if(!isok(A, len, x)) len = getmin(A, len + 1, x);
                else {
                    if(x <= last) {
                        int j; x = last - x + 1;
                        for(j = len; j >= 1 && x; j--) {
                            int t = min(A[j], x);
                            x -= t; A[j] -= t;
                        }
                        for(x = 1; j >= 1 && x; j--) {
                            A[j] += x;
                            x = A[j] / 10;
                            A[j] %= 10;
                        }
                    } else {
                        x -= last;
                        for(int j = len; j >= 1; j--) {
                            int t = min(9 - A[j], x);
                            x -= t; A[j] += t;
                        }
                    }
                }
            }
            last = now;
            for(int j = 1; j <= len; j++) printf("%d", A[j]);
            printf("\n");
        }
    }
    return 0;
}


#include <bits/stdc++.h>

#define __(x) cout << #x << " : " << x << endl;
#define out(a, i, n) for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;

using namespace std;

int a[303];

vector <int> getNum(int sum, vector <int> prev, int prev_sum)
{
    int temp_sum = 0;
    vector <int> num;
//TODO:
    bool f = false;
    for (int i = 0; i < prev.size() && !f; i++)
    {
        if (prev_sum + 1 - temp_sum <= sum && sum <= prev_sum - temp_sum + 9 - prev[i] + 9 * i && 9 - prev[i])
        {
            f = true;
            num = prev;
                int g = prev_sum - temp_sum + 1;
                num[i]++;
                int j = 0;
                for (int k = 0; k < i; k++)
                    num[k] = 0;
                while (sum - g > 9)
                {
                    if (j >= num.size())
                        num.push_back(9);
                    else
                        num[j] = 9;
                    j++;
                    g += 9;
                }
                if (j == num.size())
                    num.push_back(sum - g);
                else
                    num[j] += sum - g;
                j++;
                for (int k = j; k < i; k++)
                    num[k] = 0;
            break;
        }
        temp_sum += prev[i];
    }
    if (f)
        return num;
    num.resize(prev.size() + 1, 0);
    num[num.size() - 1] = 1;
    int g = 1;
    int j = 0;
    while (sum - g > 9)
    {
        int c = j == num.size() ? 0 : num[j];
        if (j == num.size())
            num.push_back(9);
        else
            num[j] = 9;
        j++;
        g += 9 - c;
        //cout << ":";
    }
    if (j == num.size())
        num.push_back(sum - g);
    else
    {
        if (j == prev.size())
        {
            if (sum - g == 9)
            {
                num[j] = 9;
                num.push_back(1);
            }
            else
                num[j] = sum - g + 1;
        }
        else
            num[j] = sum - g;
    }
    return num;
}

void gen()
{
    freopen("input.txt", "w", stdout);
    cout << 300 << endl;
    for (int i = 0; i < 300; i++)
        cout << 20 << endl;
}

void print(vector <int> num)
{
    for (int i = num.size() - 1; i >= 0; --i)
        printf("%d", num[i]);
    printf(" ");
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector <int> p;
    p.push_back(0);
    for (int i = 0; i < n; i++)
    {
        p = getNum(a[i], p, i ? a[i-1] : 0);
        print(p);
    }
    //cout << (double) clock() / CLOCKS_PER_SEC << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;

#define md 1000000007
#define eb emplace_back
#define pb push_back
#define INF 1000000000
#define y yyy
#define __(x) cout << #x << " : " << x << endl;

void gen()
{
	freopen("input.txt", "w", stdout);

}
//
//void check()
//{
//	if (k == 10)
//	{
//		k = 1;
//		z++;
//	}
//}

int a[333];
int t, k, z, p;
int d[333];
int pos;
int sum;

void output()
{
	for (int i = pos - 1; i >= 0; i--)
		cout << d[i];
	cout << endl;
}

void add(int t)
{
	sum = 0;
	int j = 0;
	while (t)
	{
		d[j++] += t % 10;
		t /= 10;
	}
	for (int i = 0; i < pos; i++)
	{
		if (d[i] > 9)
		{
			d[i] -= 10;
			d[i + 1]++;
		}
	}
	if (d[pos])
		pos++;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

void _minus(int t)
{
	int j = 0;
	while (t)
	{
		d[j++] -= t % 10;
		t /= 10;
		if (d[j - 1] < 0)
		{
			d[j]--;
			d[j - 1] += 10;
		}
	}
	if (d[j - 1] < 0)
	{
		d[j]--;
		d[j - 1] += 10;
	}
	if (!d[pos - 1])
		pos--;
	sum = 0;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	pos = a[0] / 9;
	for (int i = 0; i < pos; i++)
		d[i] = 9;
	pos++;
	d[pos - 1] = a[0] % 9;
	sum = a[0];
	output();
	for (int i = 1; i < n; i++)
	{
		int t = 0;
		add(1);
		int temp = pos + 1;
		if (sum == a[i]) { output(); continue;
	}
		while (9 * temp >= a[i])
			temp--;
		d[temp]++;
		int j = temp;
		while (d[j] > 9)
		{
			d[j] -= 10;
			d[j + 1]++;
			j++;
		}
		for (int k = 0; k < j; k++)
			d[k] = 0;
		sum = 0;
		if (d[pos]) pos++;
		for (int k = 0; k < pos; k++)
			sum += d[k];
		while (sum != a[i])
		{
			if (sum < a[i])
			{
				add(9 - d[0]);
				if (sum > a[i])
				{
					_minus(sum - a[i]);
				}
				if (sum != a[i]) add(1);
			}

			if (sum > a[i])
			{
				add(10 - d[0]);
				//_minus(a[i] - sum);
			}
		}

		output();

	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;

#define md 1000000007
#define eb emplace_back
#define pb push_back
#define INF 1000000000
#define y yyy
#define __(x) cout << #x << " : " << x << endl;

void gen()
{
	freopen("input.txt", "w", stdout);

}
//
//void check()
//{
//	if (k == 10)
//	{
//		k = 1;
//		z++;
//	}
//}

int a[333];
int t, k, z, p;
int d[333];
int pos;
int sum;

void output()
{
	for (int i = pos - 1; i >= 0; i--)
		cout << d[i];
	cout << endl;
}

void add(int t)
{
	sum = 0;
	d[0] += t;
	for (int i = 0; i < pos; i++)
	{
		if (d[i] > 9)
		{
			d[i] -= 10;
			d[i + 1]++;
		}
		else
			break;
	}
	if (d[pos])
		pos++;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

void _minus(int t)
{
	d[0] -= t;
	for (int i = 0; i < pos; i++)
	{
		if (d[i] < 0)
		{
			d[i + 1]--;
			d[i] += 10;
		}
		else
			break;
	}
	if (!d[pos - 1])
		pos--;
	sum = 0;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	pos = a[0] / 9;
	for (int i = 0; i < pos; i++)
		d[i] = 9;
	pos++;
	d[pos - 1] = a[0] % 9;
	sum = a[0];
	output();
	for (int i = 1; i < n; i++)
	{
		int t = 0;
		add(1);
		int temp = 1;

		while (sum != a[i])
		{
			if (sum < a[i])
			{
				add(9 - d[0]);
				if (sum > a[i])
				{
					_minus(sum - a[i]);
				}
			}

			if (sum > a[i])
			{
				add(10 - d[0]);
				//_minus(a[i] - sum);
			}
		}

		output();

	}
	return 0;
}


#include <bits/stdc++.h>

#define __(x) cout << #x << " : " << x << endl;
#define out(a, i, n) for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;

using namespace std;

int a[303];

vector <int> getNum(int sum, vector <int> prev, int prev_sum)
{
    int temp_sum = 0;
    vector <int> num;
//TODO:
    bool f = false;
    for (int i = 0; i < prev.size() && !f; i++)
    {
        if (prev_sum + 1 - temp_sum <= sum && sum <= prev_sum - temp_sum + 9 - prev[i] + 9 * i && 9 - prev[i])
        {
            f = true;
            num = prev;
                int g = prev_sum - temp_sum + 1;
                num[i]++;
                int j = 0;
                for (int k = 0; k < i; k++)
                    num[k] = 0;
                while (sum - g > 9)
                {
                    if (j >= num.size())
                        num.push_back(9);
                    else
                        num[j] = 9;
                    j++;
                    g += 9;
                }
                if (j == num.size())
                    num.push_back(sum - g);
                else
                    num[j] += sum - g;
                j++;
                for (int k = j; k < i; k++)
                    num[k] = 0;
            break;
        }
        temp_sum += prev[i];
    }
    if (f)
        return num;
    num.resize(prev.size() + 1, 0);
    num[num.size() - 1] = 1;
    int g = 1;
    int j = 0;
    while (sum - g > 9)
    {
        int c = num[j];
        if (j == num.size())
            num.push_back(9);
        else
            num[j] = 9;
        j++;
        g += 9 - c;
    }
    if (j == num.size())
        num.push_back(sum - g);
    else
        num[j] = sum - g;
    return num;
}

void gen()
{
    freopen("input.txt", "w", stdout);
    cout << 300 << endl;
    for (int i = 0; i < 300; i++)
        cout << 20 << endl;
}

void print(vector <int> num)
{
    for (int i = num.size() - 1; i >= 0; --i)
        printf("%d", num[i]);
    printf(" ");
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector <int> p;
    p.push_back(0);
    for (int i = 0; i < n; i++)
    {
        p = getNum(a[i], p, i ? a[i-1] : 0);
        print(p);
    }
    //cout << (double) clock() / CLOCKS_PER_SEC << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;

#define md 1000000007
#define eb emplace_back
#define pb push_back
#define INF 1000000000
#define y yyy
#define __(x) cout << #x << " : " << x << endl;

void gen()
{
	freopen("input.txt", "w", stdout);

}
//
//void check()
//{
//	if (k == 10)
//	{
//		k = 1;
//		z++;
//	}
//}

int a[333];
int t, k, z, p;
int d[333];
int pos;
int sum;

void output()
{
	for (int i = pos - 1; i >= 0; i--)
		cout << d[i];
	cout << endl;
}

void add(int t)
{
	sum = 0;
	int j = 0;
	while (t)
	{
		d[j++] += t % 10;
		t /= 10;
	}
	for (int i = 0; i < pos; i++)
	{
		if (d[i] > 9)
		{
			d[i] -= 10;
			d[i + 1]++;
		}
	}
	if (d[pos])
		pos++;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

void _minus(int t)
{
	int j = 0;
	while (t)
	{
		d[j++] -= t % 10;
		t /= 10;
		if (d[j - 1] < 0)
		{
			d[j]--;
			d[j - 1] += 10;
		}
	}
	if (d[j - 1] < 0)
	{
		d[j]--;
		d[j - 1] += 10;
	}
	if (!d[pos - 1])
		pos--;
	sum = 0;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	pos = a[0] / 9;
	for (int i = 0; i < pos; i++)
		d[i] = 9;
	pos++;
	d[pos - 1] = a[0] % 9;
	sum = a[0];
	output();
	for (int i = 1; i < n; i++)
	{
		int t = 0;
		add(1);
		int temp = pos;
		if (sum == a[i]) { output(); continue;
	}
		while (9 * temp >= a[i])
			temp--;
		d[temp]++;
		int j = temp;
		while (d[j] > 9)
		{
			d[j] -= 10;
			d[j + 1]++;
			j++;
		}
		for (int k = 0; k < j; k++)
			d[k] = 0;
		sum = 0;
		if (d[pos]) pos++;
		for (int k = 0; k < pos; k++)
			sum += d[k];
		while (sum != a[i])
		{
			if (sum < a[i])
			{
				add(9 - d[0]);
				if (sum > a[i])
				{
					_minus(sum - a[i]);
				}
				if (sum != a[i]) add(1);
			}

			if (sum > a[i])
			{
				add(10 - d[0]);
				//_minus(a[i] - sum);
			}
		}

		output();

	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;

#define md 1000000007
#define eb emplace_back
#define pb push_back
#define INF 1000000000
#define y yyy
#define __(x) cout << #x << " : " << x << endl;

void gen()
{
	freopen("input.txt", "w", stdout);

}
//
//void check()
//{
//	if (k == 10)
//	{
//		k = 1;
//		z++;
//	}
//}

int a[333];
int t, k, z, p;
int d[333];
int pos;
int sum;

void output()
{
	for (int i = pos - 1; i >= 0; i--)
		cout << d[i];
	cout << endl;
}

void add(int t)
{
	sum = 0;
	int j = 0;
	while (t)
	{
		d[j++] += t % 10;
		t /= 10;
	}
	for (int i = 0; i < pos; i++)
	{
		if (d[i] > 9)
		{
			d[i] -= 10;
			d[i + 1]++;
		}
	}
	if (d[pos])
		pos++;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

void _minus(int t)
{
	int j = 0;
	while (t)
	{
		d[j++] -= t % 10;
		t /= 10;
		if (d[j - 1] < 0)
		{
			d[j]--;
			d[j - 1] += 10;
		}
	}
	if (d[j - 1] < 0)
	{
		d[j]--;
		d[j - 1] += 10;
	}
	if (!d[pos - 1])
		pos--;
	sum = 0;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	pos = a[0] / 9;
	for (int i = 0; i < pos; i++)
		d[i] = 9;
	pos++;
	d[pos - 1] = a[0] % 9;
	sum = a[0];
	output();
	for (int i = 1; i < n; i++)
	{
		int t = 0;
		add(1);
		int temp = pos;
		while (9 * temp >= a[i])
			temp--;
		d[temp]++;
		int j = temp;
		while (d[j] > 9)
		{
			d[j] -= 10;
			d[j + 1]++;
			j++;
		}
		for (int k = 0; k < j; k++)
			d[k] = 0;
		sum = 0;
		if (d[pos]) pos++;
		for (int k = 0; k < pos; k++)
			sum += d[k];
		while (sum != a[i])
		{
			if (sum < a[i])
			{
				add(9 - d[0]);
				if (sum > a[i])
				{
					_minus(sum - a[i]);
				}
				if (sum != a[i]) add(1);
			}

			if (sum > a[i])
			{
				add(10 - d[0]);
				//_minus(a[i] - sum);
			}
		}

		output();

	}
	return 0;
}


#include <bits/stdc++.h>

#define __(x) cout << #x << " : " << x << endl;
#define out(a, i, n) for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;

using namespace std;

int a[303];

vector <int> getNum(int sum, vector <int> prev, int prev_sum)
{
    int temp_sum = 0;
    vector <int> num;
//TODO:
    bool f = false;
    for (int i = 0; i < prev.size() && !f; i++)
    {
        if (prev_sum + 1 - temp_sum <= sum && sum <= prev_sum - temp_sum + 9 - prev[i] + 9 * i && 9 - prev[i])
        {
            f = true;
            num = prev;
                int g = prev_sum - temp_sum + 1;
                num[i]++;
                int j = 0;
                for (int k = 0; k < i; k++)
                    num[k] = 0;
                while (sum - g > 9)
                {
                    if (j >= num.size())
                        num.push_back(9);
                    else
                        num[j] = 9;
                    j++;
                    g += 9;
                }
                if (j == num.size())
                    num.push_back(sum - g);
                else
                    num[j] += sum - g;
                j++;
                for (int k = j; k < i; k++)
                    num[k] = 0;
            break;
        }
        temp_sum += prev[i];
    }
    if (f)
        return num;
    num.resize(prev.size() + 1, 0);
    num[num.size() - 1] = 1;
    int g = 1;
    int j = 0;
    bool t = false;
    while ((!t && sum - g > 9) || (t && sum - g > 8))
    {
        if (j == prev.size() + 1) t = true;
        int c = num[j];
        if (j == num.size())
            num.push_back(9);
        else
            num[j] = 9;
        j++;
        g += 9 - c;
    }
    if (j == num.size())
        num.push_back(sum - g);
    else
        num[j] += sum - g;
    return num;
}

void gen()
{
    freopen("input.txt", "w", stdout);
    cout << 300 << endl;
    for (int i = 0; i < 300; i++)
        cout << 20 << endl;
}

void print(vector <int> num)
{
    for (int i = num.size() - 1; i >= 0; --i)
        printf("%d", num[i]);
    printf(" ");
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector <int> p;
    p.push_back(0);
    for (int i = 0; i < n; i++)
    {
        p = getNum(a[i], p, i ? a[i-1] : 0);
        print(p);
    }
    //cout << (double) clock() / CLOCKS_PER_SEC << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;

#define md 1000000007
#define eb emplace_back
#define pb push_back
#define INF 1000000000
#define y yyy
#define __(x) cout << #x << " : " << x << endl;

void gen()
{
	freopen("input.txt", "w", stdout);

}
//
//void check()
//{
//	if (k == 10)
//	{
//		k = 1;
//		z++;
//	}
//}

int a[333];
int t, k, z, p;
int d[333];
int pos;
int sum;

void output()
{
	for (int i = pos - 1; i >= 0; i--)
		cout << d[i];
	cout << endl;
}

void add(int t)
{
	sum = 0;
	d[0] += t;
	for (int i = 0; i < pos; i++)
	{
		if (d[i] > 9)
		{
			d[i] -= 10;
			d[i + 1]++;
		}
		else
			break;
	}
	if (d[pos])
		pos++;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

void _minus(int t)
{
	d[0] -= t;
	for (int i = 0; i < pos; i++)
	{
		if (d[i] < 0)
		{
			d[i + 1]--;
			d[i] += 10;
		}
		else
			break;
	}
	if (!d[pos - 1])
		pos--;
	sum = 0;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	pos = a[0] / 9;
	for (int i = 0; i < pos; i++)
		d[i] = 9;
	pos++;
	d[pos - 1] = a[0] % 9;
	sum = a[0];
	output();
	for (int i = 1; i < n; i++)
	{
		int t = 0;
		add(1);
		int temp = 1;

		while (sum != a[i])
		{
			add(1);
		}

		output();

	}
	return 0;
}


#include <bits/stdc++.h>

#define __(x) cout << #x << " : " << x << endl;
#define out(a, i, n) for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;

using namespace std;

int a[303];

vector <int> getNum(int sum, vector <int> prev, int prev_sum)
{
    int temp_sum = 0;
    vector <int> num;
//TODO:
    bool f = false;
    for (int i = 0; i < prev.size() && !f; i++)
    {
        if (prev_sum + 1 - temp_sum <= sum && sum <= prev_sum - temp_sum + 9 - prev[i] + 9 * i && 9 - prev[i])
        {
            f = true;
            num = prev;
                int g = prev_sum - temp_sum + 1;
                num[i]++;
                int j = 0;
                for (int k = 0; k < i; k++)
                    num[k] = 0;
                while (sum - g > 9)
                {
                    if (j >= num.size())
                        num.push_back(9);
                    else
                        num[j] = 9;
                    j++;
                    g += 9;
                }
                if (j == num.size())
                    num.push_back(sum - g);
                else
                    num[j] += sum - g;
                j++;
                for (int k = j; k < i; k++)
                    num[k] = 0;
            break;
        }
        temp_sum += prev[i];
    }
    if (f)
        return num;
    num.resize(1);
    int g = 0;
    int j = 0;
    while (sum - g > 9)
    {
        if (j == num.size())
            num.push_back(9);
        else
            num[j] = 9;
        j++;
        g += 9;
    }
    if (j == num.size())
        num.push_back(sum - g);
    else
        num[j] = sum - g;
    return num;
}

void gen()
{
    freopen("input.txt", "w", stdout);
    cout << 300 << endl;
    for (int i = 0; i < 300; i++)
        cout << 20 << endl;
}

void print(vector <int> num)
{
    for (int i = num.size() - 1; i >= 0; --i)
        printf("%d", num[i]);
    printf(" ");
}

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector <int> p;
    p.push_back(0);
    for (int i = 0; i < n; i++)
    {
        p = getNum(a[i], p, i ? a[i-1] : 0);
        print(p);
    }
    //cout << (double) clock() / CLOCKS_PER_SEC << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <cstdlib>
#include <vector>

using namespace std;

#define md 1000000007
#define eb emplace_back
#define pb push_back
#define INF 1000000000
#define y yyy
#define __(x) cout << #x << " : " << x << endl;

void gen()
{
	freopen("input.txt", "w", stdout);

}
//
//void check()
//{
//	if (k == 10)
//	{
//		k = 1;
//		z++;
//	}
//}

int a[333];
int t, k, z, p;
int d[333];
int pos;
int sum;

void output()
{
	for (int i = pos - 1; i >= 0; i--)
		cout << d[i];
	cout << endl;
}

void add(int t)
{
	sum = 0;
	int j = 0;
	while (t)
	{
		d[j++] += t % 10;
		t /= 10;
	}
	for (int i = 0; i < pos; i++)
	{
		if (d[i] > 9)
		{
			d[i] -= 10;
			d[i + 1]++;
		}
	}
	if (d[pos])
		pos++;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

void _minus(int t)
{
	int j = 0;
	while (t)
	{
		d[j++] -= t % 10;
		t /= 10;
		if (d[j - 1] < 0)
		{
			d[j]--;
			d[j - 1] += 10;
		}
	}
	if (d[j - 1] < 0)
	{
		d[j]--;
		d[j - 1] += 10;
	}
	if (!d[pos - 1])
		pos--;
	sum = 0;
	for (int i = 0; i < pos; i++)
		sum += d[i];
}

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	pos = a[0] / 9;
	for (int i = 0; i < pos; i++)
		d[i] = 9;
	pos++;
	d[pos - 1] = a[0] % 9;
	sum = a[0];
	output();
	for (int i = 1; i < n; i++)
	{
		int t = 0;
		add(1);
		int temp = pos;
		if (sum == a[i]) { output(); continue;
	}
		while (9 * temp >= a[i])
			temp--;
		d[temp]++;
		int j = temp;
		while (d[j] > 9)
		{
			d[j] -= 10;
			d[j + 1]++;
			j++;
		}
		for (int k = 0; k < j; k++)
			d[k] = 0;
		sum = 0;
		if (d[pos]) pos++;
		for (int k = 0; k < pos; k++)
			sum += d[k];
		while (sum != a[i])
		{
			if (sum < a[i])
			{
				add(9 - d[0]);
				if (sum > a[i])
				{
					_minus(sum - a[i]);
				}
				if (sum != a[i]) add(1);
			}

			if (sum > a[i])
			{
				add(10 - d[0]);
				//_minus(a[i] - sum);
			}
		}

		output();

	}
	return 0;
}


#include <bits/stdc++.h>

#define __(x) cout << #x << " : " << x << endl;
#define out(a, i, n) for (int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;

using namespace std;

int a[303];

int getSum(vector <int> num)
{
    int sum = 0;
    for (int i = 0; i < num.size(); i++)
        sum += num[i];
    return sum;
}

vector <int> getNum(int sum, vector <int> prev)
{
    int prev_sum = getSum(prev);
    int temp_sum = 0;
    vector <int> num;
//TODO:
    bool f = false;
    for (int i = 0; i < prev.size() && !f; i++)
    {
        if (prev_sum + 1 - temp_sum <= sum && sum <= prev_sum - temp_sum + 9 - prev[i] + 9 * i && 9 - prev[i])
        {
            f = true;
            num = prev;

                int g = prev_sum - temp_sum + 1;
                num[i]++;
                int j = 0;
                for (int k = 0; k < i; k++)
                    num[k] = 0;
                while (sum - g > 9)
                {
                    if (j >= num.size())
                        num.push_back(9);
                    else
                        num[j] = 9;
                    j++;
                    g += 9;
                }
                if (j == num.size())
                    num.push_back(sum - g);
                else
                    num[j] += sum - g;
                j++;
                for (int k = j; k < i; k++)
                    num[k] = 0;

            break;
        }
        temp_sum += prev[i];
    }
    if (f)
        return num;
    num.resize(prev.size() + 1);
    num[num.size() - 1] = 1;
    int s = 1;
    int j = 0;
    while (s < sum)
    {
        if (s + 9 >= sum)
        {
            num[j] = sum - s;
            break;
        }
    }
    return num;
}

void print(vector <int> num)
{
    for (int i = num.size() - 1; i >= 0; --i)
        printf("%d", num[i]);
    printf(" ");
}

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector <int> p;
    p.push_back(0);
    for (int i = 0; i < n; i++)
    {
        p = getNum(a[i], p);
        print(p);
    }
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
    string ret = pr;
    int sum = 0;
    for (int i = 0; i < pr.size(); i++)
    {
        sum += pr[i] - '0';
    }
    if (sum == s)
    {
        int hlp;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            if (ret[i] != '0' && ret[i - 1] != '9')
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
                ret[i - 1]++;
                sum++;
                hlp = i;
                break;
            }
            else
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
            }
        }
    }
    if (sum > s)
    {
        int s2 = 0;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            s2 += ret[i] - '0';
            ret[i] = '0';
            if (s2 > (sum - s))
            {
                for (int k = i - 1; k >= 0; k--)
                {
                    if (ret[k] != '9')
                    {
                        ret[k]++;
                        sum -= s2 - 1;
                        break;
                    }
                    else
                    {
                        s2 += 9;
                        ret[k] = '0';
                    }
                }
                break;
            }
        }
    }
    if (sum < s)
    {
        int x = ret.size() - 1;
        while (sum < s)
        {
            for (int i = x; i >= 0; i--)
            {
                if (ret[i] < '9')
                {
                    ret[i]++;
                    sum++;
                    break;
                }
                else
                {
                    x = i - 1;
                }
            }
        }
    }
    return ret;
}

//init
inline void init()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
}

//Solve
inline void solve()
{
    string t = "";
    for (int i = 0; i < maxN; i++) t += '0';
    for (int i = 0; i < n; i++)
    {
        t = f(A[i], t);
        bool pr = false;
        for (int i = 0; i < t.size(); i++)
        {
            if (!pr && t[i] != '0') pr = true;
            if (pr) cout << t[i];
        }
        cout << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    //freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);
    init();
    solve();
    //system("pause");
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
    string ret = pr;
    int sum = 0;
    for (int i = 0; i < pr.size(); i++)
    {
        sum += pr[i] - '0';
    }
    if (sum == s)
    {
        int hlp;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            if (ret[i] != '0' && ret[i - 1] != '9')
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
                ret[i - 1]++;
                sum++;
                hlp = i;
                break;
            }
            else
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
            }
        }
    }
    if (sum > s)
    {
        int s2 = 0;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            s2 += ret[i] - '0';
            ret[i] = '0';
            if (s2 > (sum - s))
            {
                for (int k = i - 1; k >= 0; k--)
                {
                    if (ret[k] != '9')
                    {
                        ret[k]++;
                        sum -= s2 - 1;
                        break;
                    }
                    else
                    {
                        s2 += 9;
                        ret[k] = '0';
                    }
                }
                break;
            }
        }
    }
    if (sum < s)
    {
        int x = ret.size() - 1;
        while (sum < s)
        {
            for (int i = x; i >= 0; i--)
            {
                if (ret[i] < '9')
                {
                    ret[i]++;
                    sum++;
                    break;
                }
                else
                {
                    x = i - 1;
                }
            }
        }
    }
    return ret;
}

//init
inline void init()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
}

//Solve
inline void solve()
{
    string t = "";
    for (int i = 0; i < 2 * maxN; i++) t += '0';
    for (int i = 0; i < n; i++)
    {
        t = f(A[i], t);
        bool pr = false;
        for (int i = 0; i < t.size(); i++)
        {
            if (!pr && t[i] != '0') pr = true;
            if (pr) cout << t[i];
        }
        cout << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    //freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);
    init();
    solve();
    //system("pause");
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 110;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;
vector <int> ans[maxN];

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum == s)
	{
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			if (ret[i] != '9')
			{
				ret[i]++;
				sum++;
				break;
			}
		}
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size()-1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				ret[i - 1]++;
				sum -= s2 - 1;
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "0000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if(pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
    string ret = pr;
    int sum = 0;
    for (int i = 0; i < pr.size(); i++)
    {
        sum += pr[i] - '0';
    }
    if (sum == s)
    {
        int hlp;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            if (ret[i] != '0' && ret[i - 1] != '9')
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
                ret[i - 1]++;
                sum++;
                hlp = i;
                break;
            }
            else
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
            }
        }
    }
    if (sum > s)
    {
        int s2 = 0;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            s2 += ret[i] - '0';
            ret[i] = '0';
            if (s2 > (sum - s))
            {
                for (int k = i - 1; k >= 0; k--)
                {
                    if (ret[k] != '9')
                    {
                        ret[k]++;
                        sum -= s2 - 1;
                        break;
                    }
                    else
                    {
                        s2 += 9;
                        ret[k] = 0;
                    }
                }
                break;
            }
        }
    }
    if (sum < s)
    {
        int x = ret.size() - 1;
        while (sum < s)
        {
            for (int i = x; i >= 0; i--)
            {
                if (ret[i] < '9')
                {
                    ret[i]++;
                    sum++;
                    break;
                }
                else
                {
                    x = i - 1;
                }
            }
        }
    }
    return ret;
}

//init
inline void init()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
}

//Solve
inline void solve()
{
    string t = "00000000000000000000000000000000000000";
    for (int i = 0; i < n; i++)
    {
        t = f(A[i], t);
        bool pr = false;
        for (int i = 0; i < t.size(); i++)
        {
            if (!pr && t[i] != '0') pr = true;
            if (pr) cout << t[i];
        }
        cout << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    //freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);
    init();
    solve();
    //system("pause");
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum == s)
	{
		int hlp;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			if (ret[i] != '0')
			{
				ret[i]--;
				hlp = i;
				break;
			}
		}
		for (int i = hlp - 1; i >= 0; i--)
		{
			if (ret[i] != '9')
			{
				ret[i]++;
				break;
			}
		}
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				for (int k = i - 1; k >= 0; k--)
				{
					if (ret[k] != '9')
					{
						ret[k]++;
						sum -= s2 - 1;
						break;
					}
				}
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
				else
				{
					x = i;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "00000000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if (pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 110;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;
vector <int> ans[maxN];

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size()-1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				ret[i - 1]++;
				sum -= s2 - 1;
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "0000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if(pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum == s)
	{
		int hlp;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			if (ret[i] != '0' && ret[i-1] != '9')
			{
				ret[i]--;
				ret[i - 1]++;
				hlp = i;
				break;
			}
		}
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				for (int k = i - 1; k >= 0; k--)
				{
					if (ret[k] != '9')
					{
						ret[k]++;
						sum -= s2 - 1;
						break;
					}
					else
					{
						s2 += ret[i] - '0';
						ret[i] = 0;
					}
				}
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
				else
				{
					x = i - 1;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "00000000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if (pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
    string ret = pr;
    int sum = 0;
    for (int i = 0; i < pr.size(); i++)
    {
        sum += pr[i] - '0';
    }
    if (sum == s)
    {
        int hlp;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            if (ret[i] != '0' && ret[i - 1] != '9')
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
                ret[i - 1]++;
                sum++;
                hlp = i;
                break;
            }
            else
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
            }
        }
    }
    if (sum > s)
    {
        int s2 = 0;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            s2 += ret[i] - '0';
            ret[i] = '0';
            if (s2 > (sum - s))
            {
                for (int k = i - 1; k >= 0; k--)
                {
                    if (ret[k] != '9')
                    {
                        ret[k]++;
                        sum -= s2 - 1;
                        break;
                    }
                    else
                    {
                        s2 += 9;
                        ret[k] = '0';
                    }
                }
                break;
            }
        }
    }
    if (sum < s)
    {
        int x = ret.size() - 1;
        while (sum < s)
        {
            for (int i = x; i >= 0; i--)
            {
                if (ret[i] < '9')
                {
                    ret[i]++;
                    sum++;
                    break;
                }
                else
                {
                    x = i - 1;
                }
            }
        }
    }
    return ret;
}

//init
inline void init()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
}

//Solve
inline void solve()
{
    string t = "00000000000000000000000000000000000000";
    for (int i = 0; i < n; i++)
    {
        t = f(A[i], t);
        bool pr = false;
        for (int i = 0; i < t.size(); i++)
        {
            if (!pr && t[i] != '0') pr = true;
            if (pr) cout << t[i];
        }
        cout << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    //freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);
    init();
    solve();
    //system("pause");
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum == s)
	{
		int hlp;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			if (ret[i] != '0' && ret[i-1] != '9')
			{
				ret[i]--;
				ret[i - 1]++;
				hlp = i;
				break;
			}
		}
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				for (int k = i - 1; k >= 0; k--)
				{
					if (ret[k] != '9')
					{
						ret[k]++;
						sum -= s2 - 1;
						break;
					}
					else
					{
						s2 += 9;
						ret[k] = 0;
					}
				}
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
				else
				{
					x = i - 1;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "00000000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if (pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 110;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;
vector <int> ans[maxN];

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum == s)
	{
		int hlp;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			if (ret[i] != '0')
			{
				ret[i]--;
				hlp = i;
				break;
			}
		}
		for (int i = hlp - 1; i >= 0; i--)
		{
			if (ret[i] != '9')
			{
				ret[i]++;
				break;
			}
		}
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size()-1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				for (int k = i - 1; k >= 0; k--)
				{
					if (ret[k] != '9')
					{
						ret[k]++;
						sum -= s2 - 1;
						break;
					}
				}
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
				else
				{
					x = i;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "00000000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if(pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
	string ret = pr;
	int sum = 0;
	for (int i = 0; i < pr.size(); i++)
	{
		sum += pr[i] - '0';
	}
	if (sum == s)
	{
		int hlp;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			if (ret[i] != '0' && ret[i-1] != '9')
			{
				ret[i]--;
				ret[i - 1]++;
				hlp = i;
				break;
			}
		}
	}
	if (sum > s)
	{
		int s2 = 0;
		for (int i = ret.size() - 1; i >= 0; i--)
		{
			s2 += ret[i] - '0';
			ret[i] = '0';
			if (s2 > (sum - s))
			{
				for (int k = i - 1; k >= 0; k--)
				{
					if (ret[k] != '9')
					{
						ret[k]++;
						sum -= s2 - 1;
						break;
					}
				}
				break;
			}
		}
	}
	if (sum < s)
	{
		int x = ret.size() - 1;
		while (sum < s)
		{
			for (int i = x; i >= 0; i--)
			{
				if (ret[i] < '9')
				{
					ret[i]++;
					sum++;
					break;
				}
				else
				{
					x = i;
				}
			}
		}
	}
	return ret;
}

//init
inline void init()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
}

//Solve
inline void solve()
{
	string t = "00000000000000000000000000000000000000";
	for (int i = 0; i < n; i++)
	{
		t = f(A[i], t);
		bool pr = false;
		for (int i = 0; i < t.size(); i++)
		{
			if (!pr && t[i] != '0') pr = true;
			if (pr) cout << t[i];
		}
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("f.in", "r", stdin);
	//freopen("f.out", "w", stdout);
	init();
	solve();
	//system("pause");
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cassert>
#include<stack>
#include<cstring>
#include<vector>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<complex>

#define mp(makepairtmp1,makepairtmp2) make_pair(makepairtmp1,makepairtmp2)
#define X real()
#define Y imag()

using namespace std;

//def
const int MOD = 10;
typedef long long ll;
typedef long double ld;
const double eps = 1e-5;
const int maxN = 330;
const int inf = 1e9;
int n, k, A[maxN];
int m1 = 0, m2 = 0;

string f(int s, string pr)
{
    string ret = pr;
    int sum = 0;
    for (int i = 0; i < pr.size(); i++)
    {
        sum += pr[i] - '0';
    }
    if (sum == s)
    {
        int hlp;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            if (ret[i] != '0' && ret[i - 1] != '9')
            {
                ret[i]--;
                ret[i - 1]++;
                hlp = i;
                break;
            }
            else
            {
                sum -= ret[i] - '0';
                ret[i] = '0';
            }
        }
    }
    if (sum > s)
    {
        int s2 = 0;
        for (int i = ret.size() - 1; i >= 0; i--)
        {
            s2 += ret[i] - '0';
            ret[i] = '0';
            if (s2 > (sum - s))
            {
                for (int k = i - 1; k >= 0; k--)
                {
                    if (ret[k] != '9')
                    {
                        ret[k]++;
                        sum -= s2 - 1;
                        break;
                    }
                    else
                    {
                        s2 += 9;
                        ret[k] = 0;
                    }
                }
                break;
            }
        }
    }
    if (sum < s)
    {
        int x = ret.size() - 1;
        while (sum < s)
        {
            for (int i = x; i >= 0; i--)
            {
                if (ret[i] < '9')
                {
                    ret[i]++;
                    sum++;
                    break;
                }
                else
                {
                    x = i - 1;
                }
            }
        }
    }
    return ret;
}

//init
inline void init()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
}

//Solve
inline void solve()
{
    string t = "00000000000000000000000000000000000000";
    for (int i = 0; i < n; i++)
    {
        t = f(A[i], t);
        bool pr = false;
        for (int i = 0; i < t.size(); i++)
        {
            if (!pr && t[i] != '0') pr = true;
            if (pr) cout << t[i];
        }
        cout << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    //freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);
    init();
    solve();
    //system("pause");
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 310;
int n;

int b[maxn];
int a[500];

void get(int *a, int &len, int b) {
    for(int i = len; i < 500; i++) a[i] = 0;
    int X[500] = {0};
    for(int pos = 0; ; pos++) {
        if(a[pos] == 9) continue;
        int B = b;
        for(int i = len; i > pos; i--) {
            X[i] = a[i];
            B -= a[i];
        }

        X[pos] = a[pos] + 1;
        B -= a[pos] + 1;
        if(B < 0) continue;
        if(pos * 9 < B) continue;
        for(int i = pos - 1; i >= 0; i--) {
            int k = 0;
            while(B - k > i * 9) k++;
            X[i] = k;
            B -= k;
        }
        memcpy(a, X, sizeof(X));
        len = max(len, pos + 1);
        return;
    }
}

void test() {
    char s[100];
    int n;
    while(scanf("%s%d", s, &n) != EOF) {
        int len = strlen(s);
        for(int i = len - 1; i >= 0; i--) {
            a[len - i - 1] = s[i] - '0';
        }
        get(a, len, n);
        for(int i = len - 1; i >= 0; i--)
            printf("%d", a[i]);
        printf("\n");
    }
}
int main() {
    //test();
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 110;
int n;
int b[maxn];
int a[200];
void get(int *a, int &len, int b) {
    int X[200], XLEN;
    for(int i = max(len, (b + 8) / 9); ; i++) {
        int flag = 0;
        int B = b;
        for(int j = i - 1; j >= 0; j--) {
            int k;
            if(flag) k = 0;
            else {
                if(j >= len) {
                    k = 1;
                    flag = 1;
                } else {
                    k = a[j];
                }
            }
            while(B - k > 9 * j) {
                k++;
                flag = 1;
            }
            X[j] = k;
            B -= k;
        }
        if(flag) {
            memcpy(a, X, sizeof(X));
            len = i;
            return;
        }
    }
}
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 110;
int n;

int b[maxn];
int a[200];

void get(int *a, int &len, int b) {
    int next = 0;
    for(int i = 0; i < len; i++) {
        a[i] = (a[i] + (i == 0) + next);
        next = a[i] / 10;
        a[i] = a[i] % 10;
    }
    if(next) {
        a[len++] = 1;
    }
    int X[200], XLEN;
    int pos = -1;
    for(int i = max(len, (b + 8) / 9); ; i++) {
        int B = b;
        int flag = 0;
        for(int j = i - 1; j >= 0; j--) {
            int k;
            if(pos == j) {
                k = a[j] + 1;
                flag = 1;
                X[j] = k;
                B -= k;
                continue;
            }
            if(flag) k = 0;
            else {
                if(j >= len) {
                    k = 1;
                    flag = 1;
                } else {
                    k = a[j];
                }
            }
            while(B - k > 9 * j) {
                k++;
                flag = 1;
            }
            X[j] = k;
            B -= k;
        }
        if(B != 0) {
            if(pos == -1) {
                if(i == 1) continue;
                pos = 1;
                i--;
                continue;
            }
            else if(pos != i - 1) {
                pos++;
                i--;
                continue;
            } else {
                pos = -1;
                continue;
            }
        }
        memcpy(a, X, sizeof(X));
        len = i;
        return;

    }
}
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 310;
int n;

int b[maxn];
int a[500];

void get(int *a, int &len, int b) {
    int next = 0;
    for(int i = 0; i < len; i++) {
        a[i] = (a[i] + (i == 0) + next);
        next = a[i] / 10;
        a[i] = a[i] % 10;
    }
    if(next) {
        a[len++] = 1;
    }
    int X[500], XLEN;
    int pos = -1;
    for(int i = max(len, (b + 8) / 9); ; i++) {
        int B = b;
        int flag = 0;
        for(int j = i - 1; j >= 0; j--) {
            int k;
            if(pos == j) {
                k = a[j] + 1;
                flag = 1;
                X[j] = k;
                B -= k;
                continue;
            }
            if(flag) k = 0;
            else {
                if(j >= len) {
                    k = 1;
                    flag = 1;
                } else {
                    k = a[j];
                }
            }
            while(B - k > 9 * j) {
                k++;
                flag = 1;
            }
            X[j] = k;
            B -= k;
        }
        if(B != 0) {
            if(pos == -1) {
                if(i == 1) continue;
                pos = 1;
                i--;
                continue;
            }
            else if(pos != i - 1) {
                pos++;
                while(pos != i && a[pos] == 9) pos++;
                if(pos == i) {
                    pos = -1;
                    continue;
                }
                i--;
                continue;
            } else {
                pos = -1;
                continue;
            }
        }
        memcpy(a, X, sizeof(X));
        len = i;
        return;

    }
}

void test() {
    char s[100];
    int n;
    while(scanf("%s%d", s, &n) != EOF) {
        int len = strlen(s);
        for(int i = len - 1; i >= 0; i--) {
            a[len - i - 1] = s[i] - '0';
        }
        get(a, len, n);
        for(int i = len - 1; i >= 0; i--)
            printf("%d", a[i]);
        printf("\n");
    }
}
int main() {
   // test();
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 110;
int n;
int b[maxn];
int a[200];
void get(int *a, int &len, int b) {
    int X[200], XLEN;
    for(int i = len; ; i++) {
        int flag = 0;
        int B = b;
        for(int j = i - 1; j >= 0; j--) {
            int k;
            if(flag) k = 0;
            else {
                if(j >= len) {
                    k = 1;
                    flag = 1;
                } else {
                    k = a[j];
                }
            }
            while(B - k > 9 * j) {
                k++;
                flag = 1;
            }
            X[j] = k;
            B -= k;
        }
        if(flag) {
            memcpy(a, X, sizeof(X));
            len = i;
            return;
        }
    }
}
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 0;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 310;
int n;

int b[maxn];
int a[500];

void get(int *a, int &len, int b) {
    int next = 0;
    for(int i = 0; i < len; i++) {
        a[i] = (a[i] + (i == 0) + next);
        next = a[i] / 10;
        a[i] = a[i] % 10;
    }
    if(next) {
        a[len++] = 1;
    }
    int X[500], XLEN;
    int pos = -1;
    for(int i = max(len, (b + 8) / 9); ; i++) {
        int B = b;
        int flag = 0;
        for(int j = i - 1; j >= 0; j--) {
            int k;
            if(pos == j) {
                k = a[j] + 1;
                flag = 1;
                X[j] = k;
                B -= k;
                continue;
            }
            if(flag) k = 0;
            else {
                if(j >= len) {
                    k = 1;
                    flag = 1;
                } else {
                    k = a[j];
                }
            }
            while(B - k > 9 * j) {
                k++;
                flag = 1;
            }
            X[j] = k;
            B -= k;
        }
        if(B != 0) {
            if(pos == -1) {
                if(i == 1) continue;
                pos = 1;
                i--;
                continue;
            }
            else if(pos != i - 1) {
                pos++;
                i--;
                continue;
            } else {
                pos = -1;
                continue;
            }
        }
        memcpy(a, X, sizeof(X));
        len = i;
        return;

    }
}
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 310;
int n;

int b[maxn];
int a[500];

void get(int *a, int &len, int b) {
    for(int i = len; i < 500; i++) a[i] = 0;
    int X[500] = {0};
    for(int pos = 0; ; pos++) {
        for(int d = 1; d + a[pos] <= 9; d++) {
            int B = b;
            for(int i = len; i > pos; i--) {
                X[i] = a[i];
                B -= a[i];
            }

            X[pos] = a[pos] + d;
            B -= a[pos] + d;
            if(B < 0) continue;
            if(pos * 9 < B) continue;
            for(int i = pos - 1; i >= 0; i--) {
                int k = 0;
                while(B - k > i * 9) k++;
                X[i] = k;
                B -= k;
            }
            memcpy(a, X, sizeof(X));
            len = max(len, pos + 1);
            return;
        }

    }
}

void test() {
    char s[100];
    int n;
    while(scanf("%s%d", s, &n) != EOF) {
        int len = strlen(s);
        for(int i = len - 1; i >= 0; i--) {
            a[len - i - 1] = s[i] - '0';
        }
        get(a, len, n);
        for(int i = len - 1; i >= 0; i--)
            printf("%d", a[i]);
        printf("\n");
    }
}
int main() {
    //test();
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 110;
int n;

int b[maxn];
int a[200];

void get(int *a, int &len, int b) {
    int next = 0;
    for(int i = 0; i < len; i++) {
        a[i] = (a[i] + (i == 0) + next);
        next = a[i] / 10;
        a[i] = a[i] % 10;
    }
    if(next) {
        a[len++] = 1;
    }
    int X[200], XLEN;
    int pos = -1;
    for(int i = max(len, (b + 8) / 9); ; i++) {
        int B = b;
        int flag = 0;
        for(int j = i - 1; j >= 0; j--) {
            int k;
            if(pos == j) {
                k = a[j] + 1;
                flag = 1;
                X[j] = k;
                B -= k;
                continue;
            }
            if(flag) k = 0;
            else {
                if(j >= len) {
                    k = 1;
                    flag = 1;
                } else {
                    k = a[j];
                }
            }
            while(B - k > 9 * j) {
                k++;
                flag = 1;
            }
            X[j] = k;
            B -= k;
        }
        if(B != 0) {
            if(pos == -1) {
                pos = 1;
                i--;
                continue;
            }
            else if(pos != len - 1) {
                pos++;
                i--;
                continue;
            } else {
                pos = -1;
                continue;
            }
        }
        memcpy(a, X, sizeof(X));
        len = i;
        return;

    }
}
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> b[i];
    a[0] = 0;
    int len = 1;
    for(int i = 1; i <= n; i++) {
        get(a, len, b[i]);
        for(int j = len - 1; j >= 0; j--)
            printf("%d", a[j]);
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];
void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(c%9))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(c%9);
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j))){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)){tata(s-temq[j]);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
	return 0;                   }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];
void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(c%9))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(c%9);
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j)+temq[j])){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
    return 0;                   }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];
void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(c%9))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(c%9);
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j)+temq[j])){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
    return 0;              }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];
void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(c%9))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(c%9);
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j))){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
    return 0;                   }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];
void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(c%9))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(c%9);
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j)+temq[j])){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
    mareturn 0;                   }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];

int mod9(int c)                  {
	while(c>9){c=c-9;}return c;  }

void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(mod9(c)))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(mod9(c));
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j)+temq[j])){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
    return 0;                   }


#include<stdio.h>
#include<iostream>
int n;
int ar[1000][301];
int br[300];
int temp[1000],temq[1000],temt[1000];

int mod9(int c)                  {
	while(c>9){c=c-9;}return c;  }

void sifir(int *xr)              {
	for (int k=0;k<=999;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=999;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(mod9(c)))/9);
    for (int j=1;j<=a;j++){temp[1000-j]=9;}temp[999-a]=(mod9(c));
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=999; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(999-j)+temq[j])){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(999-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=999; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=998;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[999][v]);}
    return 0;                   }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];

int mod9(int c)                  {
	while(c>9){c=c-9;}return c;  }

void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(mod9(c)))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(mod9(c));
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j)+temq[j])){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(299-j)+temq[j]){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
    main();return 0;              }


#include<stdio.h>
#include<iostream>
int n;
int ar[300][301];
int br[300];
int temp[300],temq[300],temt[300];
void sifir(int *xr)              {
	for (int k=0;k<=299;k++){xr[k]=0;}
	return;		                 }

int bul(int *xr)                 {
	int l;
	for (l=0;l<=299;l++) {if(xr[l]==0){}else break;}
	return (l);		             }

void tata(int c)                 {
	int a=((c-(c%9))/9);
    for (int j=1;j<=a;j++){temp[300-j]=9;}temp[299-a]=(c%9);
	return;                      }

int ozel(int c)                  {
	int m=0;while(temq[c]==9){m=m+9;c++;}
	m=m+temq[c];
	return m;                    }

int main()                       {
    scanf("%d",&n);
	for (int k=0;k<=n-1;k++){scanf("%d",&br[k]);}
	for (int i=1;i<=n;i++)                 {
		 for (int q = 0; q <=299; q++) {temq[q]=ar[q][i-1];}
		 int j=0;int s=br[i-1];
		 while(s>(temq[j]+ozel(j+1))&&(s<=9*(299-j))){temp[j]=temq[j];s=s-temp[j];j++;}
		 if(s>9*(300-j)){tata(s);}else{temp[j]=temq[j]+1;tata(s-temq[j]-1);}
		 for (int q = 0; q <=299; q++) {ar[q][i]=temp[q];}
	     temt[i]=bul(temp);
	     sifir(temp);sifir(temq);}

	for (int v=1;v<=n;v++){int u=temt[v];for(int q=u;q<=298;q++){printf("%d",ar[q][v]);}printf("%d\n",ar[299][v]);}
	return 0;                   }


#include<cstdio>
#include<algorithm>
using namespace std;
int a1[350],n=-1;
void f(int a)
{
	for(int i=0;;n=max(n,++i))
	{
		int b=min(a,9-a1[i]);
		a1[i]+=b,a-=b;
		if(!a)break;
	}
}
int main()
{
	int m,a=0,b;bool bl;
	scanf("%d",&m);
	for(;m--;a=b)
	{
		scanf("%d",&b);
		if(b>a)f(b-a);
		else
		{
			a=b-a;
			for(int i=0;;n=max(n,++i))
			if(a1[i]<9&&a>0)
			{++a1[i];f(a-1);break;}
			else{a+=a1[i];a1[i]=0;}
		}
		for(int i=n;~i;--i)
			printf("%d",a1[i]);
		puts("");
	}
}


#include<cstdio>
#include<algorithm>
using namespace std;
int a1[350],n=-1;
void f(int a)
{
	for(int i=0;;n=max(n,++i))
	{
		int b=min(a,9-a1[i]);
		a1[i]+=b,a-=b;
		if(!a)break;
	}
}
int main()
{
	int n,m,a=0,b;bool bl;
	scanf("%d",&m);
	for(;m--;a=b)
	{
		scanf("%d",&b);
		if(b>a)f(b-a);
		else
		{
			a=b-a;
			for(int i=0;;n=max(n,++i))
			if(a1[i]<9&&a>0)
			{++a1[i];f(a-1);break;}
			else{a+=a1[i];a1[i]=0;}
		}
		for(int i=n;~i;--i)
			printf("%d",a1[i]);
		puts("");
	}
}


#include<cstdio>
#include<algorithm>
using namespace std;
int a1[350],n=0;
void f(int a)
{
	for(int i=0;;n=max(n,++i))
	{
		int b=min(a,9-a1[i]);
		a1[i]+=b,a-=b;
		if(!a)break;
	}
}
int main()
{
	int m,a=0,b;bool bl;
	scanf("%d",&m);
	for(;m--;a=b)
	{
		scanf("%d",&b);
		if(b>a)f(b-a);
		else
		{
			a=b-a;
			for(int i=0;;n=max(n,++i))
			if(a1[i]<9&&a>0)
			{++a1[i];f(a-1);break;}
			else{a+=a1[i];a1[i]=0;}
		}
		for(int i=n;~i;--i)
			printf("%d",a1[i]);
		puts("");
	}
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

#define min(a, b)  a < b ? a : b
#define max(a, b)  a > b ? a : b

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define repab(i,a,b) for(int i=a;i<=b;++i)
#define dwn(i,n) for (int i=n-1;i>-1;--i)
#define dwn1(i,n) for (int i=n;i>0;--i)
#define dwnab(i,a,b) for(int i=a;i>=b;--i)
#define each(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)

#define pair pii<int, int>
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sortv(v) sort(all(v))

#define mset(m) memset(m,0,sizeof(m))

#define sz(c) (int)c.size()
#define ff first
#define ss second

#define SI ({int x;scanf("%d", &x);x;});
#define SL ({LL x;scanf("%I64d", &x);x;});

#define PI(n) printf("%d", n);
#define PLL(n) printf("%I64d", n);

#define PILN(n) printf("%d\n", n);
#define PLLN(n) printf("%I64d\n", n);

#define PLN printf("\n");

#define MAX 355

typedef int BigNum[MAX];

inline bool isGreater(int *a, int *b)
{
	if (a[0] > b[0])
		return 1;
	else if (a[0] < b[0])
		return 0;
	rep1(i, a[0])
		if (a[i] > b[i])
			return 1;
		else if (a[i] < b[i])
			return 0;
	return 0;
}

void copy(int *a, int *b)
{
	for (int i = 0; i <= a[0]; i++)
		b[i] = a[i];
}

void build(int *a, int digits)
{
	rep1(i, digits)
		a[i] = 0;
	a[0] = digits;
	a[1] = 1;
	int sum = a[333] - 1;

	dwn1(i, digits)
	{
		int dif = min(9 - a[i], sum);
		a[i] += dif;
		sum -= dif;
		if (!sum)
			break;
	}
}

BigNum L;

void next(int *bef, int *cur, int minDigits)
{
	int sumBef = bef[333], sumCur = cur[333];

	if (minDigits > bef[0])
	{
		build(cur, minDigits);
		return;
	}

	int minSum = 0;
	rep1(i, bef[0])
	{
		minSum += bef[i];
		if (bef[i] != 9)
			break;
	}

	if (minSum >= sumCur)
	{
		build(cur, minDigits+1);
		return;
	}

	copy(bef, cur);

	if (sumBef >= sumCur)
	{
		int s = sumBef - sumCur;

		dwn1(i, cur[0])
		{
			int dif = min(cur[i], s);
			cur[i] -= dif;
			s -= dif;
			if (!s)
				break;
		}

		int idx = cur[0];
		while (cur[idx] == 0) idx--;

		int nxt = idx-1;
		while (cur[nxt] == 9) nxt--;

		cur[nxt]++;
		cur[idx]--;

		int *last = L;
		s = 0;
		nxt++;
		repab(i, nxt, cur[0])
			s += cur[i];

		last[333] = s;
		build(last, cur[0] - nxt + 1);

		repab(i, nxt, cur[0])
			cur[i] = last[i-nxt+1];
	}
	else
	{
		int s = sumCur - sumBef;

		dwn1(i, cur[0])
		{
			int dif = min(9 - cur[i], s);
			cur[i] += dif;
			s -= dif;
			if (!s)
				break;
		}
	}

}

void print(int *a)
{
	rep1(i, a[0])
		PI(a[i])
	PLN
}

int *before, *current, *tmp;
BigNum A, B;
int n, c;

int main()
{
	A[0] = A[333] = 0;
	before = A;
	current = B;

	n = SI

	rep1(i,n)
	{
		c = SI
		int minDigits = (c + 8) / 9;
		minDigits = max(minDigits, before[0]);
		current[333] = c;
		next(before, current, minDigits);
		print(current);
		tmp = current;
		current = before;
		before = tmp;
	}

    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

#define min(a, b)  a < b ? a : b
#define max(a, b)  a > b ? a : b

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define repab(i,a,b) for(int i=a;i<=b;++i)
#define dwn(i,n) for (int i=n-1;i>-1;--i)
#define dwn1(i,n) for (int i=n;i>0;--i)
#define dwnab(i,a,b) for(int i=a;i>=b;--i)
#define each(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)

#define pair pii<int, int>
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sortv(v) sort(all(v))

#define mset(m) memset(m,0,sizeof(m))

#define sz(c) (int)c.size()
#define ff first
#define ss second

#define SI ({int x;scanf("%d", &x);x;});
#define SL ({LL x;scanf("%I64d", &x);x;});

#define PI(n) printf("%d", n);
#define PLL(n) printf("%I64d", n);

#define PILN(n) printf("%d\n", n);
#define PLLN(n) printf("%I64d\n", n);

#define PLN printf("\n");

#define MAX 355

typedef int BigNum[MAX];

inline bool isGreater(int *a, int *b)
{
	if (a[0] > b[0])
		return 1;
	else if (a[0] < b[0])
		return 0;
	rep1(i, a[0])
		if (a[i] > b[i])
			return 1;
		else if (a[i] < b[i])
			return 0;
	return 0;
}

void findNext(int *a)
{

}

void copy(int *a, int *b)
{
	for (int i = 0; i <= a[0]; i++)
		b[i] = a[i];
}

void build(int *a, int digits)
{
	a[0] = digits;
	a[1] = 1;
	int sum = a[333] - 1;

	dwn1(i, digits)
	{
		int dif = min(8, sum);
		a[i] += dif;
		sum -= dif;
		if (!sum)
			break;
	}
}

void next(int *bef, int *cur, int minDigits)
{
	int sumBef = bef[333], sumCur = cur[333];

	if (minDigits > bef[0])
	{
		build(cur, minDigits);
		return;
	}

	int minSum = 0;
	rep1(i, bef[0])
	{
		minSum += bef[i];
		if (bef[i] != 9)
			break;
	}

	if (minSum >= sumCur)
	{
		build(cur, minDigits+1);
		return;
	}

	copy(bef, cur);

	if (sumBef >= sumCur)
	{
		int s = sumBef - sumCur;

		dwn1(i, cur[0])
		{
			int dif = min(cur[i], s);
			cur[i] -= dif;
			s -= dif;
			if (!s)
				break;
		}

		int idx = cur[0];
		while (cur[idx] == 0) idx--;

		int nxt = idx-1;
		while (cur[nxt] == 9) nxt--;

		cur[nxt]++;
		cur[idx]--;

		BigNum L;
		int *last = L;
		s = 0;
		nxt++;
		repab(i, nxt, cur[0])
			s += cur[i];

		last[333] = s;
		build(last, cur[0] - nxt + 1);

		repab(i, nxt, cur[0])
			cur[i] = last[i];
	}
	else
	{
		int s = sumCur - sumBef;

		dwn1(i, cur[0])
		{
			int dif = min(9 - cur[i], s);
			cur[i] += dif;
			s -= dif;
			if (!s)
				break;
		}
	}

}

void print(int *a)
{
	rep1(i, a[0])
		PI(a[i])
	PLN
}

int *before, *current, *tmp;
BigNum A, B;
int a[MAX], n, c;

int main()
{
	A[0] = A[333] = 0;
	before = A;
	current = B;

	n = SI

	rep1(i,n)
	{
		c = SI
		int minDigits = (c + 8) / 9;
		minDigits = max(minDigits, before[0]);
		current[333] = c;
		next(before, current, minDigits);
		print(current);
		tmp = current;
		current = before;
		before = tmp;
	}

    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

#define min(a, b)  a < b ? a : b
#define max(a, b)  a > b ? a : b

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define repab(i,a,b) for(int i=a;i<=b;++i)
#define dwn(i,n) for (int i=n-1;i>-1;--i)
#define dwn1(i,n) for (int i=n;i>0;--i)
#define dwnab(i,a,b) for(int i=a;i>=b;--i)
#define each(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)

#define pair pii<int, int>
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sortv(v) sort(all(v))

#define mset(m) memset(m,0,sizeof(m))

#define sz(c) (int)c.size()
#define ff first
#define ss second

#define SI ({int x;scanf("%d", &x);x;});
#define SL ({LL x;scanf("%I64d", &x);x;});

#define PI(n) printf("%d", n);
#define PLL(n) printf("%I64d", n);

#define PILN(n) printf("%d\n", n);
#define PLLN(n) printf("%I64d\n", n);

#define PLN printf("\n");

#define MAX 777
#define SUM 666

typedef int BigNum[MAX];

inline bool isGreater(int *a, int *b)
{
	if (a[0] > b[0])
		return 1;
	else if (a[0] < b[0])
		return 0;
	rep1(i, a[0])
		if (a[i] > b[i])
			return 1;
		else if (a[i] < b[i])
			return 0;
	return 0;
}

void copy(int *a, int *b)
{
	for (int i = 0; i <= a[0]; i++)
		b[i] = a[i];
}

void build(int *a, int digits, bool leading)
{
	rep1(i, digits)
		a[i] = 0;
	a[0] = digits;
	a[1] = leading;
	int sum = a[SUM] - leading;

	dwn1(i, digits)
	{
		int dif = min(9 - a[i], sum);
		a[i] += dif;
		sum -= dif;
		if (!sum)
			break;
	}
}
BigNum L;

void next(int *bef, int *cur, int minDigits)
{
	int sumBef = bef[SUM], sumCur = cur[333];

	if (minDigits > bef[0])
	{
		build(cur, minDigits, 1);
		return;
	}

	int minSum = 0;
	rep1(i, bef[0])
	{
		minSum += bef[i];
		if (bef[i] != 9)
			break;
	}

	if (minSum >= sumCur)
	{
		build(cur, minDigits+1, 1);
		return;
	}

	copy(bef, cur);

	if (sumBef >= sumCur)
	{
		int s = sumBef - sumCur;

		dwn1(i, cur[0])
		{
			int dif = min(cur[i], s);
			cur[i] -= dif;
			s -= dif;
			if (!s)
				break;
		}

		int idx = cur[0];
		while (cur[idx] == 0) idx--;

		int nxt = idx-1;
		while (cur[nxt] == 9) nxt--;

		cur[nxt]++;
		cur[idx]--;

		int *last = L;
		s = 0;
		nxt++;
		repab(i, nxt, cur[0])
			s += cur[i];

		last[SUM] = s;
		build(last, cur[0] - nxt + 1, 0);

		repab(i, nxt, cur[0])
			cur[i] = last[i-nxt+1];
	}
	else
	{
		int s = sumCur - sumBef;

		dwn1(i, cur[0])
		{
			int dif = min(9 - cur[i], s);
			cur[i] += dif;
			s -= dif;
			if (!s)
				break;
		}
	}

}

void print(int *a)
{
	rep1(i, a[0])
		PI(a[i])
	PLN
}

int *before, *current, *tmp;
BigNum A, B;
int n, c;

int main()
{
	A[0] = A[SUM] = 0;
	before = A;
	current = B;

	n = SI

	rep1(i,n)
	{
		c = SI
		int minDigits = (c + 8) / 9;
		minDigits = max(minDigits, before[0]);
		current[SUM] = c;
		next(before, current, minDigits);
		print(current);
		tmp = current;
		current = before;
		before = tmp;
	}

    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

#define min(a, b)  a < b ? a : b
#define max(a, b)  a > b ? a : b

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define repab(i,a,b) for(int i=a;i<=b;++i)
#define dwn(i,n) for (int i=n-1;i>-1;--i)
#define dwn1(i,n) for (int i=n;i>0;--i)
#define dwnab(i,a,b) for(int i=a;i>=b;--i)
#define each(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)

#define pair pii<int, int>
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sortv(v) sort(all(v))

#define mset(m) memset(m,0,sizeof(m))

#define sz(c) (int)c.size()
#define ff first
#define ss second

#define SI ({int x;scanf("%d", &x);x;});
#define SL ({LL x;scanf("%I64d", &x);x;});

#define PI(n) printf("%d", n);
#define PLL(n) printf("%I64d", n);

#define PILN(n) printf("%d\n", n);
#define PLLN(n) printf("%I64d\n", n);

#define PLN printf("\n");

#define MAX 777
#define SUM 666

typedef int BigNum[MAX];

inline bool isGreater(int *a, int *b)
{
	if (a[0] > b[0])
		return 1;
	else if (a[0] < b[0])
		return 0;
	rep1(i, a[0])
		if (a[i] > b[i])
			return 1;
		else if (a[i] < b[i])
			return 0;
	return 0;
}

void copy(int *a, int *b)
{
	for (int i = 0; i <= a[0]; i++)
		b[i] = a[i];
}

void build(int *a, int digits, bool leading)
{
	rep1(i, digits)
		a[i] = 0;
	a[0] = digits;
	a[1] = leading;
	int sum = a[SUM] - leading;

	dwn1(i, digits)
	{
		int dif = min(9 - a[i], sum);
		a[i] += dif;
		sum -= dif;
		if (!sum)
			break;
	}
}
BigNum L;

void next(int *bef, int *cur, int minDigits)
{
	int sumBef = bef[SUM], sumCur = cur[SUM];

	if (minDigits > bef[0])
	{
		build(cur, minDigits, 1);
		return;
	}

	int minSum = 0;
	rep1(i, bef[0])
	{
		minSum += bef[i];
		if (bef[i] != 9)
			break;
	}

	if (minSum >= sumCur)
	{
		build(cur, minDigits+1, 1);
		return;
	}

	copy(bef, cur);

	if (sumBef >= sumCur)
	{
		int s = sumBef - sumCur;

		dwn1(i, cur[0])
		{
			int dif = min(cur[i], s);
			cur[i] -= dif;
			s -= dif;
			if (!s)
				break;
		}

		int idx = cur[0];
		while (cur[idx] == 0) idx--;

		int nxt = idx-1;
		while (cur[nxt] == 9) nxt--;

		cur[nxt]++;
		cur[idx]--;

		int *last = L;
		s = 0;
		nxt++;
		repab(i, nxt, cur[0])
			s += cur[i];

		last[SUM] = s;
		build(last, cur[0] - nxt + 1, 0);

		repab(i, nxt, cur[0])
			cur[i] = last[i-nxt+1];
	}
	else
	{
		int s = sumCur - sumBef;

		dwn1(i, cur[0])
		{
			int dif = min(9 - cur[i], s);
			cur[i] += dif;
			s -= dif;
			if (!s)
				break;
		}
	}

}

void print(int *a)
{
	rep1(i, a[0])
		PI(a[i])
	PLN
}

int *before, *current, *tmp;
BigNum A, B;
int n, c;

int main()
{
	A[0] = A[SUM] = 0;
	before = A;
	current = B;

	n = SI

	rep1(i,n)
	{
		c = SI
		int minDigits = (c + 8) / 9;
		minDigits = max(minDigits, before[0]);
		current[SUM] = c;
		next(before, current, minDigits);
		print(current);
		tmp = current;
		current = before;
		before = tmp;
	}

    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

#define min(a, b)  a < b ? a : b
#define max(a, b)  a > b ? a : b

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define repab(i,a,b) for(int i=a;i<=b;++i)
#define dwn(i,n) for (int i=n-1;i>-1;--i)
#define dwn1(i,n) for (int i=n;i>0;--i)
#define dwnab(i,a,b) for(int i=a;i>=b;--i)
#define each(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)

#define pair pii<int, int>
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sortv(v) sort(all(v))

#define mset(m) memset(m,0,sizeof(m))

#define sz(c) (int)c.size()
#define ff first
#define ss second

#define SI ({int x;scanf("%d", &x);x;});
#define SL ({LL x;scanf("%I64d", &x);x;});

#define PI(n) printf("%d", n);
#define PLL(n) printf("%I64d", n);

#define PILN(n) printf("%d\n", n);
#define PLLN(n) printf("%I64d\n", n);

#define PLN printf("\n");

#define MAX 355

typedef int BigNum[MAX];

inline bool isGreater(int *a, int *b)
{
	if (a[0] > b[0])
		return 1;
	else if (a[0] < b[0])
		return 0;
	rep1(i, a[0])
		if (a[i] > b[i])
			return 1;
		else if (a[i] < b[i])
			return 0;
	return 0;
}

void copy(int *a, int *b)
{
	for (int i = 0; i <= a[0]; i++)
		b[i] = a[i];
}

void build(int *a, int digits)
{
	rep1(i, digits)
		a[i] = 0;
	a[0] = digits;
	a[1] = 1;
	int sum = a[333] - 1;

	dwn1(i, digits)
	{
		int dif = min(8, sum);
		a[i] += dif;
		sum -= dif;
		if (!sum)
			break;
	}
}

BigNum L;

void next(int *bef, int *cur, int minDigits)
{
	int sumBef = bef[333], sumCur = cur[333];

	if (minDigits > bef[0])
	{
		build(cur, minDigits);
		return;
	}

	int minSum = 0;
	rep1(i, bef[0])
	{
		minSum += bef[i];
		if (bef[i] != 9)
			break;
	}

	if (minSum >= sumCur)
	{
		build(cur, minDigits+1);
		return;
	}

	copy(bef, cur);

	if (sumBef >= sumCur)
	{
		int s = sumBef - sumCur;

		dwn1(i, cur[0])
		{
			int dif = min(cur[i], s);
			cur[i] -= dif;
			s -= dif;
			if (!s)
				break;
		}

		int idx = cur[0];
		while (cur[idx] == 0) idx--;

		int nxt = idx-1;
		while (cur[nxt] == 9) nxt--;

		cur[nxt]++;
		cur[idx]--;

		int *last = L;
		s = 0;
		nxt++;
		repab(i, nxt, cur[0])
			s += cur[i];

		last[333] = s;
		build(last, cur[0] - nxt + 1);

		repab(i, nxt, cur[0])
			cur[i] = last[i-nxt+1];
	}
	else
	{
		int s = sumCur - sumBef;

		dwn1(i, cur[0])
		{
			int dif = min(9 - cur[i], s);
			cur[i] += dif;
			s -= dif;
			if (!s)
				break;
		}
	}

}

void print(int *a)
{
	rep1(i, a[0])
		PI(a[i])
	PLN
}

int *before, *current, *tmp;
BigNum A, B;
int n, c;

int main()
{
	A[0] = A[333] = 0;
	before = A;
	current = B;

	n = SI

	rep1(i,n)
	{
		c = SI
		int minDigits = (c + 8) / 9;
		minDigits = max(minDigits, before[0]);
		current[333] = c;
		next(before, current, minDigits);
		print(current);
		tmp = current;
		current = before;
		before = tmp;
	}

    return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

typedef long long LL;
typedef double DB;
typedef unsigned UINT;
typedef unsigned long long ULL;

#define min(a, b)  a < b ? a : b
#define max(a, b)  a > b ? a : b

#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define repab(i,a,b) for(int i=a;i<=b;++i)
#define dwn(i,n) for (int i=n-1;i>-1;--i)
#define dwn1(i,n) for (int i=n;i>0;--i)
#define dwnab(i,a,b) for(int i=a;i>=b;--i)
#define each(it, A) for (__typeof(A.begin()) it=A.begin(); it != A.end(); ++it)

#define pair pii<int, int>
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define sortv(v) sort(all(v))

#define mset(m) memset(m,0,sizeof(m))

#define sz(c) (int)c.size()
#define ff first
#define ss second

#define SI ({int x;scanf("%d", &x);x;});
#define SL ({LL x;scanf("%I64d", &x);x;});

#define PI(n) printf("%d", n);
#define PLL(n) printf("%I64d", n);

#define PILN(n) printf("%d\n", n);
#define PLLN(n) printf("%I64d\n", n);

#define PLN printf("\n");

#define MAX 355

typedef int BigNum[MAX];

inline bool isGreater(int *a, int *b)
{
	if (a[0] > b[0])
		return 1;
	else if (a[0] < b[0])
		return 0;
	rep1(i, a[0])
		if (a[i] > b[i])
			return 1;
		else if (a[i] < b[i])
			return 0;
	return 0;
}

void copy(int *a, int *b)
{
	for (int i = 0; i <= a[0]; i++)
		b[i] = a[i];
}

void build(int *a, int digits, bool leading)
{
	rep1(i, digits)
		a[i] = 0;
	a[0] = digits;
	a[1] = leading;
	int sum = a[333] - leading;

	dwn1(i, digits)
	{
		int dif = min(9 - a[i], sum);
		a[i] += dif;
		sum -= dif;
		if (!sum)
			break;
	}
}
BigNum L;

void next(int *bef, int *cur, int minDigits)
{
	int sumBef = bef[333], sumCur = cur[333];

	if (minDigits > bef[0])
	{
		build(cur, minDigits, 1);
		return;
	}

	int minSum = 0;
	rep1(i, bef[0])
	{
		minSum += bef[i];
		if (bef[i] != 9)
			break;
	}

	if (minSum >= sumCur)
	{
		build(cur, minDigits+1, 1);
		return;
	}

	copy(bef, cur);

	if (sumBef >= sumCur)
	{
		int s = sumBef - sumCur;

		dwn1(i, cur[0])
		{
			int dif = min(cur[i], s);
			cur[i] -= dif;
			s -= dif;
			if (!s)
				break;
		}

		int idx = cur[0];
		while (cur[idx] == 0) idx--;

		int nxt = idx-1;
		while (cur[nxt] == 9) nxt--;

		cur[nxt]++;
		cur[idx]--;

		int *last = L;
		s = 0;
		nxt++;
		repab(i, nxt, cur[0])
			s += cur[i];

		last[333] = s;
		build(last, cur[0] - nxt + 1, 0);

		repab(i, nxt, cur[0])
			cur[i] = last[i-nxt+1];
	}
	else
	{
		int s = sumCur - sumBef;

		dwn1(i, cur[0])
		{
			int dif = min(9 - cur[i], s);
			cur[i] += dif;
			s -= dif;
			if (!s)
				break;
		}
	}

}

void print(int *a)
{
	rep1(i, a[0])
		PI(a[i])
	PLN
}

int *before, *current, *tmp;
BigNum A, B;
int n, c;

int main()
{
	A[0] = A[333] = 0;
	before = A;
	current = B;

	n = SI

	rep1(i,n)
	{
		c = SI
		int minDigits = (c + 8) / 9;
		minDigits = max(minDigits, before[0]);
		current[333] = c;
		next(before, current, minDigits);
		print(current);
		tmp = current;
		current = before;
		before = tmp;
	}

    return 0;
}