PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000320. Đo lượng mưa (Rain Fall)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đo lượng mưa (Rain Fall)

Rain Fall

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

An initially empty rain gauge cannot overflow. A leak at height LL drains water at rate KK whenever the level exceeds LL. Rain falls at a constant unknown rate for T1T_1 hours; T2T_2 hours after it stops the observed level is HH. Ignore evaporation and the size of the leak. Find the minimum and maximum total rainfall compatible with the observation.

Input

One line contains five decimal numbers L,K,T1,T2,HL,K,T_1,T_2,H in that order: the leak height (mm), leakage rate (mm/hour), rain duration (hours), time elapsed after the rain stops (hours), and observed water level (mm). Each number has exactly two digits after the decimal point.

Output

Print the minimum and maximum rainfall. Each value is accepted if its absolute or relative error is less than 10−610^{-6}.

Subtasks

  • Subtask 1 (20 points): 0.01≤L,K,T1,T2,H≤10000.01\le L,K,T_1,T_2,H\le1000; H<LH<L.
  • Subtask 2 (30 points): 0.01≤L,K,T1,T2,H≤10000.01\le L,K,T_1,T_2,H\le1000; H≤LH\le L.
  • Subtask 3 (50 points): 0.01≤L,K,T1,T2,H≤10000.01\le L,K,T_1,T_2,H\le1000.

Examples

Input 1

80.00 0.50 2.00 1.50 80.00

Output 1

80.000000000 80.759403280

Explanation

Without leakage rainfall is 80 mm. With leakage the excess can drain back to the leak level; the maximum is approximately 80.759403 mm.

Input 2

150.00 1.00 100.00 150.00 100.00

Output 2

100.000000000 100.000000000

Explanation

The level is below the leak, so no water was lost.