Time limit
2s
Memory limit
128 MB
Dongho manages coffee at a coffee shop. Since the coffee is not selling well, he decides to drink the leftover coffee himself each day.
Dongho has an unusual tongue. If, earlier on the same day, he drank coffee stronger than the coffee he is drinking now, he cannot taste the current coffee. Coffee with the same concentration is not stronger, so he can still taste it.
At the start of a day, he prepares two jars, A and B, and fills both with coffee. Then he repeats the following process.
If jar A cannot provide one full cup, he cannot drink any more. If he has already drunk one cup from jar A but jar B cannot provide the same amount afterward, that already-drunk cup still counts.
Find how many cups of coffee Dongho can taste today.
The first line contains the initial concentration a of jar A and the initial concentration b of jar B.
The second line contains the size Sa of jar A, the size Sb of jar B, and the cup size S, all in mL.
0 <= a <= b <= 1001 <= Sa, Sb, S <= 1000A concentration is the number of grams of coffee powder contained in 1 liter.
Print, on the first line, the number of cups Dongho can taste in hexadecimal. The hexadecimal digits A, B, C, D, E, and F must be uppercase.
If the number of cups he can taste is 0 or greater than 50, print gg.
In the first sample, the concentrations of the coffee Dongho drinks are 5, 5.5, 5.94, 6.3261, ... .