لینکهای مفید برای شرکت در مسابقه:
در طول مسابقه، میتوانید سؤالات خود را از قسمت «سؤال بپرسید» مطرح کنید.
Nowadays everything depends on exchange rate of dollar (Now it is called rate due to its importance). Total atmosphere of our country has been affected by rate. But this is not the only reason of economical disorders. Some of sellers called "traitors" cause the other reason. These sellers act different in different rate swings:
Actually if rate changes from to (and ), traitors multiply their price to and round the product to the nearest(if distances were equal, to upper nearest) multiple of round base. For example if a traitor bought a pen in first day and rate changed from to and then to , and round base was , finally he sells this pen . because: and is closer to .
Ali wants to buy a battery for his laptop. But there is only one shop selling this kind of battery. Ali knows that this shop's seller is a traitor and has this battery since n days ago. Ali went to this shop and realised that the seller sells the battery p Rials and round base for this shop is b Rials. Ali wants to know how much was this battery's price d days ago. He is busy preparing problems for SBU Newbies Contest so he needs your help.
The input file contains several input sets. The description of each set is given below:
Each set starts with four integers , the number of days passed from seller's buy, , the price of battery, , round base, and , the number of days passed from Ali's slightly day, following a line with non-negative space separated integers . equals the rate when days passed from seller's buy. Actually equals the rate when seller bought the battery. It is guaranteed that Input will follow the descriptions given.Input is terminated by a set where which should not be processed. There is a blank line between two input sets. sum of over all input sets are at most and count of input sets are less than .
For each input set, produce one line of output including space separated and which respectively mean the least and the most possible prices the battery could have in d days ago.