ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1154. Mages Contest

Time limit: 1.0 second
Memory limit: 64 MB
The Powers of Light and the Powers of Darkness had gathered the best elemental mages of the Middle-earth: the Lords of Fire, Earth, Air and Water.
Sometime during 24 hours there exists the Moment of Power for each one of the elements, when the mastery of corresponding mage is in its maximum point. In contrary there exists the Moment of Weakness, when the mastery of the mage is minimum. In between these moments the mage's mastery changes linearly.
There can be several mages fighting on each side. The mages cumulative mastery is defined as sum of their individual masteries. The win is given to the side, which mages' cumulative mastery is the largest. The larger the advantage of one side over another, the easier its win is, and the smaller casualties are.
The Supreme Master, who is to declare the time of the Contest secretly wishes the Powers of Light to win, and tries to make this win as easy as possible. Assume that the Contest is held momentary, and the mastery of the mages doesn't change during it. You are to help the Supreme Master in selecting the time of the Contest.

Input

The first four lines contain information about the Moments of Weakness and the Moments of Power for mages of each of the elements. Each line contains five parameters separated by spaces: element code, the time of the Moment of Power, the mastery in the Moment of Power, the time of the Moment of Weakness, the mastery in the Moment of Weakness.
Element code is one of four capital letters: “A” for Air, “E” for Earth, “F” for Fire and “W” for Water. The time is HH:MM:SS formatted and lies between 00:00:00 and 23:59:59. The Moment of Power is not equal to the Moment of Weakness. The mastery in these moments is a positive integer less than or equal to 10000.
Then two more lines follow, which determine respectively the cast of the Powers of Light and the cast of the Powers of Darkness. Each line consists of symbols “A”, “E”, “F”, “W” representing one mage of the corresponding element. The number of the mages from each side is not less than 1 and is not greater than 1000.

Output

The first line should contain HH:MM:SS formatted time of the Contest. In the second line there should be one number with two decimal points, which represents the advantage of the Powers of Light over the Powers of Darkness. The time of the Contest should lie between 00:00:00 and 23:59:59. If there exist several moments can be chosen as the time of the Contest, then choose the earliest one.
If there is no way the Powers of Light can win, then write “We can't win!”

Samples

inputoutput
A 10:00:00 130 18:00:00 40
E 14:00:00 150 21:30:00 25
F 06:00:00 105 18:00:00 70
W 23:00:00 140 02:00:00 20
A
WWW
02:00:00
25.00
A 10:00:00 130 18:00:00 40
E 14:00:00 150 21:30:00 25
F 06:00:00 105 18:00:00 70
W 23:00:00 140 02:00:00 20
A
WWWF
We can't win!
Problem Author: Eugene Bryzgalov
Problem Source: Ural Collegiate Programming Contest, April 2001, Perm, English Round