Alladeen asks genie for a good sales week. He has made various shoes to be sold at the flea market. He sells some of them on the first day. Genie clicks its fingers and now the number of leftover shoe doubles. Alladeen sells the same number of shoes as on the previous day. That genie clicks the fingers again and the remainder is tripled. Alladeen again makes the same sale as earlier. On the fourth day, the same thing happens again. The number of shoes is now four times the number and the same sale happens. By the fifth day, Alladeen sells the same as on the previous days. But now the entire stock of shoes is over. Genie clicks its fingers and no new shoes appear. What is the number of shoes Alladeen had on the first day?