#include<iostream>
using namespace std;
long long a[100000];
int ret(int s) {
int sum = 0;
int rem = s % 9;
return rem == 0 ? 9 : rem;
}
int main() {
int n;
cin >> n;
int x = 0;
for (int i = 0;i < n;i++)
{
cin >> a[i];
x += a[i];
cout << ret(x);
}
}