s=scan("stdin");for(j in 2*1:50){r=s[j-1];q="";while(r){q=paste(r%%s[j],q,sep="");r=r%/%s[j]};write(q,"")}