
| Contests | Virtual Contests | Problems | Submit | Runs Status | Rank List | Forum |
The standard price of TheBEST is 100$ per entry normally. Moreover, to attract more and more tourists, TheBEST published many discounts for the entry ticket. So far, the discount policies include:
For one booking transaction, three discount types - advance booking (1, 2, 3), none window booking (4, 5, 6) and group booking (7, 8) can be applied for together. To illustrate the above discount policies, we have the following examples booking by today (Oct.26, 2003).
Booking 1: 1 ticket for Nov.2, 2003 by phone
(1 - 10%)*(1 - 10%)*100 = 81$
Booking 2: 5 tickets for Dec.1, 2003 by travel agency <China-Tour>
(1 - 40%)*(1 - 20%)*(1 - 10%)*100 = 43.2$
Booking 3: 30 tickets for Oct.27, 2003 by online system
(1 - 15%)*(1 - 20%)*100 = 68$
You task is to write a program to help TheBEST calculate the exact price per ticket for each booking transaction.
There are several booking transactions in the input, each transaction per line.
A transaction is shown as following format (4 items):
BookingDate EntryDate BookingWay Quantity
And then, the format for each item is:
BookingDate: MMM.DD YYYY
EntryDate: MMM.DD YYYY
where MMM represents the month (`Jan', `Feb', `Mar', `Apr', `May', `Jun', `Jul', `Aug', `Sep', `Oct', `Nov' and `Dec'), DD represents the 2 digits format of the day and YYYY represents the 4 digits format of the year.
Quantity: 3 digits from 001 to 999
BookingWay: `phone' or `online' or `agency <S>', where S is a string shows the agency information (length of S is within 100).
When Quantity equals to `000', the input ends.
For each booking transaction, output the final price per ticket, one per line.
Oct.26 2003 Nov.02 2003 phone 001 Oct.26 2003 Dec.01 2003 agency <World Trade Reservation 207548> 005 Oct.26 2003 Oct.27 2003 online 030 Oct.23 2003 Oct.23 2003 online 000
81 43.2 68