#include<iostream>
using namespace std;

int main(){

	int n, v[26];
	int w[7] = {31, 26, 21, 16, 11, 6, 1};
	
	while(cin >> n){
		if(n == 0) break;
		for(int i=0; i<n; i++){
			cin >> v[i];
		}
		
		cout << 31 << endl;
		for(int i=0; i<6; i++){
			cout << w[i] - v[i%n] << endl;
			cout << w[i+1] << endl;
		}
		cout << 0 << endl;
	}

	return 0;

}