#include #include #include #include #include #include #include using namespace std; vector vysl; int p[10]; int v[] = {1, 1, 1, 1, 1, 1, 1 ,1, 1}; int k[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int N; int a,b; void printv() { if (vysl.size() == 0) { cout << "none" << endl; return; } size_t pocvysl = vysl.size(); size_t i = 0; int posledni = -1; for (vector::iterator it = vysl.begin(); it != vysl.end(); it++) { i++; if (*it == posledni) continue; posledni = *it; if (it == vysl.begin()) cout << *it; else cout << ", " << *it; } cout << endl; } bool vypocti(int vysledek, int index) { //printf("\t%d @ %d\n", vysledek, index); if (vysledek >= a && vysledek <= b) vysl.push_back(vysledek); if (index > N) return false; if (vysledek < 0) return false; if (vysledek > b) return false; int mezivysl = vysledek; for (int i = 0; i <= 31; ++i) { if (vypocti(mezivysl, index + 1) == false) break; mezivysl = mezivysl * p[index]; } return true; } int main(void) { while (true) { vysl.clear(); cin >> N; if (N == 0) return 0; for (int i = 0; i < N; ++i) { cin >> p[i]; } cin >> a >> b; ///printf("N=%d, a=%d, b=%d\n", N, a,b); //if (a == 1) vysl.push_back(1); vypocti(1, 0); sort(vysl.begin(), vysl.end()); //unique(vysl.begin(), vysl.end()); printv(); //cout << "end" << endl; } return 0; }