#include #include #include using namespace std; struct TMP{ long long int x,last; TMP (long long int xx, long long int llast){x=xx; last = llast;} } ; int operator<(const TMP& a, const TMP& b) { return a.x > b.x; } int main() { long long int N, mn, mx; long long int prv[16]; while(1) { priority_queue pq; scanf("%lld", &N); if (N==0) return 0; N++; for(int i=1; i ", tmp.x);fflush(stdout); pq.pop(); if (tmp.x>mx) { /*if (!prvn) printf("\n");*/ break; } if (tmp.x>=mn) if (prvn) { printf("%lld", tmp.x); prvn=0; } else printf(",%lld", tmp.x); if (tmp.last!=0) pq.push(TMP(tmp.x*prv[tmp.last], tmp.last)); //printf("|lld %lld %lld|", tmp.last, N); if (tmp.last