#include<iostream>
using namespace std;
int main() {
	int k;
	while (cin >> k) {
		int n = 32, a[30];
		for (int i = 0; i < k; i++)cin >> a[i];
		for (int i = 0; n; i++) {
			int p;
			p = (n - 1) % 5;
			n -= p;
			cout << n << endl;
			p = a[i%k];
			n -= p
				; if (n < 0)n = 0; cout << n << endl;
		}
	}
}