PROG0488 - The pudding guy

David Phillips is an American civil engineer and professor at the University of California (Davis, USA). He is best known as The Pudding Guy for accumulating many frequent-flyer miles by taking advantage of a promotion by Healthy Choice in 1999.

Phillips was pushing his shopping cart down the frozen-food aisle of his local supermarket when a promotion on a Healthy Choice frozen entree caught his eye. The company was offering frequent-flyer miles to customers who bought its products and submitted the UPCs back to the company. The details of the promotion included a bonus if the UPCs were mailed during the month of May 1999 (the mileage earned would double from 500 miles to 1000 miles for every 10 UPCs submitted). Phillips calculated that the return on a mail-in food promotion outweighed the price of the Healthy Choice frozen entrees, which were selling for $2.

A few aisles away Phillips found boxes containing four Healthy Choice soup cans at 70 dollar cents. Because he did not need a freezer to store the soups, he immediately decided to purchase 200 boxes of soup cans. At home he first had some trouble explaining the hoarding behaviour to his wife, but during a subsequent visit to the supermarket they discovered together an aisle display of Healthy Choice Pudding. Normally, the pudding was sold in 4-cup packs, but the display had been intended to introduce the new pudding and the single sample cups — originally 39 cents — were on sale at just 25 cents each! A 25-cent pudding having its own barcode would thus bring 100 miles. Over the next few weeks he purchased a total of 12000 pudding cups, claiming he was stocking up for Y2K.

pudding
View on the garage where David Phillips — aka The Pudding Guy — was storing his cups of pudding.

Phillips and his wife had thus spent $3140 in total for 800 soup cans and 12000 pudding cups, but they had a problem. Not only could the family never consume this much soup and pudding, but more important they would not be able to remove the UPCs before the double certificate offer expired. After giving it some thought they enlisted the Salvation Army to help them peel off the UPC codes, in exchange for donating the pudding. He then mailed his submission to Healthy Choice, and to their credit they awarded him 1.25 million frequent-flyer miles — enough for 31 round trips to Europe, 42 to Hawaii, 21 to Australia, or 50 anywhere in the United States.

There's no downside. Phillips also got Aadvantage Gold status for life with American Airlines, which brings a special reservations number, priority boarding, upgrades, and bonus miles. And he got an $815 tax writeoff for donating the soup and the pudding.

Input

The following four numbers are read from input, each on a separate line:

  • total number of items purchased of a certain product (integer)
  • cost per item of the product (float)
  • number of UPCs needed for a frequent-flyer coupon (integer)
  • number of miles earned per frequent-flyer coupon (integer)

Output

Write to output a sentence describing the amount in dollars spent by Phillips to purchase all items of the product and the number of frequent-flyer miles he earned with this purchase. Use the output as given in the examples below as templates to format the sentence. The amount of money spent should thus be output as a floating point number and the number of frequent-flyer miles received as an integer.

Example

Input:

200
0.70
12
550

Output:

Phillips spent $140.0 for 8800 frequent-flyer miles.

Example

Input:

12000
0.25
10
1000

Output:

Phillips spent $3000.0 for 1200000 frequent-flyer miles.

David Phillips is een Amerikaans burgerlijk ingenieur en professor aan de Universiteit van Californië (Davis, VSA). Hij is vooral bekend als The Pudding Guy omdat hij in 1999 ontzettend veel frequent flyer mijlen wist te verzamelen door te profiteren van een promo-actie van Healthy Choice.

Terwijl hij inkopen aan het doen was in een supermarkt, was hem iets vreemds opgevallen. Klanten die 10 producten kochten van Healthy Choice en de barcodes terugstuurden naar het bedrijf, kregen daarvoor in ruil een coupon van 500 frequent flyer mijlen. Bovendien werd het aantal mijlen verdubbeld als de barcodes werden teruggestuurd vóór mei 1999. Phillips had al snel uitgerekend dat de promotie aan gratis vliegmijlen meer waard was dan een diepvriesmaaltijd van Healthy Choice, die verkocht werd voor $2.

Verderop in de winkel merkte hij dat er ook dozen met vier blikken soep van Healthy Choice verkocht werden voor 70 dollarcent. Omdat het niet nodig was om deze in een driepvries te bewaren, besloot hij om direct 200 dozen soepblikken in te slaan. Thuisgekomen had hij eerst wat moeite om het hamstergedrag aan zijn vrouw uit te leggen, maar bij een volgende bezoek aan de supermarkt ontdekten ze samen dat het gamma van Healthy Choice ook potjes pudding bevatte (elk met hun eigen barcode) die verkocht werden voor 25 dollarcent en dus elk 100 mijlen opleverden. De weken daarop schuimden ze alle supermarkten in de buurt af, om in totaal 12000 potjes pudding te kopen. Aan de winkeliers die hen argwanend vroegen wat ze met al die pudding van plan waren, vertelden ze dat ze zich aan het voorbereiden waren op de milleniumbug.

pudding
Zicht op de garage waarin David Phillips — alias The Pudding Guy — zijn potjes pudding gestockeerd had.

Phillips en zijn vrouw hadden dus in totaal $3140 uitgegeven aan 800 blikken soep en 12000 potjes pudding. Omdat ze eigenhandig onmogelijk alle barcodes van de verpakkingen konden halen vóór het verstrijken van de deadline, schakelden ze het Leger des Heils in om hen daarbij te helpen. In ruil schonken ze hen de soep en de pudding. Phillips stuurde al zijn barcodes naar Healthy Choice, en ontving daarvoor 1.25 miljoen frequent flyer mijlen — genoeg voor 31 reizen heen-en-terug naar Europa, 42 naar Hawaï, 21 naar Australië, of 50 overal binnen de Verenigde Staten.

Tot zijn grote verbazing zat er nergens een addertje onder het gras. Phillips kreeg ook nog levenslange Advantage Gold-status van American Airlines, goed voor speciale reserveringsnummers, voorrang bij het instappen, upgrades en bonusmijlen. En hij kreeg ook nog eens $815 terug van de belastingen voor het doneren van de soep en de pudding.

Invoer

De invoer bestaat uit de volgende vier getallen, elk op een afzonderlijke regel:

  • het aantal gekochte stuks van een bepaald product (integer)
  • de kostprijs per stuk van het product (float)
  • het aantal barcodes nodig voor een frequent flyer coupon (integer)
  • het aantal mijlen dat men ontvangt per frequent flyer coupon (integer)

Uitvoer

De uitvoer bestaat uit een zin die aangeeft hoeveel dollar Phillips spendeerde om alle stuks van het product te kopen, en hoeveel frequent flyer mijlen hij daarmee verdiende. Gebruik de uitvoer uit onderstaande voorbeelden als template om die zin op te stellen. Het uitgegeven geldbedrag moet hierbij dus uitgeschreven worden als een floating point getal en het aantal ontvangen frequent flyer mijlen als een natuurlijk getal.

Voorbeeld

Invoer:

200
0.70
12
550

Uitvoer:

Phillips spendeerde $140.0 voor 8800 frequent flyer mijlen.

Voorbeeld

Invoer:

12000
0.25
10
1000

Uitvoer:

Phillips spendeerde $3000.0 voor 1200000 frequent flyer mijlen.

Added by:Peter Dawyndt
Date:2014-08-29
Time limit:10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:PY_NBC
Resource:None

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.