CF65A Harry Potter and Three Spells

题目描述

很久以前(可能甚至在第一本书中),尼古拉斯·勒梅,一位伟大的炼金术士和魔法石的创造者,教了哈利·波特三个有用的咒语。第一种方法可以将 $a$ 克沙子转换成 $b$ 克铅,第二种方法可以将 $c$ 克铅转换成 $d$ 克金,第三种方法可以将 $e$ 克金转换成 $f$ 克沙子。 当哈利告诉他的朋友这些咒语时,罗恩很惊讶。毕竟,如果他们能把沙子变成铅,铅变成金,然后再把部分金变成沙子,那么就有可能从少量的沙子开始得到大量的金!即是无限量的黄金! 相比之下,格兰杰对这个想法持怀疑态度。她认为,根据物质守恒定律,获得无限量的物质,即使使用魔法,也是不可能的。相反,物质在转化过程中甚至会减少,转化为能量。 虽然赫敏的理论似乎令人信服,罗恩却不相信她。罗恩觉得,赫敏制定了只属于她的物质守恒定律,以阻止哈利和罗恩在这些胡言乱语上浪费时间,并且让他们去做作业。 这就是为什么罗恩已经收集了一定数量的沙子进行实验。 朋友之间的争吵似乎是不可避免的。帮助哈利确定他的朋友中哪一个是对的,避免争吵。要做到这一点,你必须弄清楚是否有可能从有限数量的沙子中获得比任何预先分配黄金数量更多的黄金数量。 ---

输入格式

输入共一行,包含 $6$ 个整数,$a,b,c,d,e,f$ $(a,b,c,d,e,f\leq 1000)$。 ---

输出格式

如果可以获得无限的黄金,输出`Ron`,否则输出`Hermione`。 --- #### 样例解释 ##### 样例一 如果最初有 $500$ 克沙子,应用第一种法术 $5$ 次,把沙子变成 $1000$ 克铅。然后应用第二个法术 $4$ 次,得到 $600$ 克黄金,把其中 $400$ 克的黄金转化成沙子,得到 $500$ 克沙子和 $200$ 克黄金。对这其中的 $500$ 克沙子进行同样的操作,可以得到无限黄金。所以输出`Ron`。 ##### 样例四 由于得不到任何物质,所以不能得到无限黄金,输出`Hermione`。 ##### 样例五 因为使用第二种法术可以无限凭空得到金子,所以输出`Ron`。 ##### 样例七 用第三种法术,可以凭空得到无限沙子。我们用这种方法先得到 $10000$ 克沙子,然后用第一种法术 $100$ 次获得 $100$ 克铅。用这些铅,可以转化为 $1$ 克黄金。显然,因为沙子数量无限,所以可以得到无限数量的黄金,输出`Ron`。

说明/提示

Consider the first sample. Let's start with the $ 500 $ grams of sand. Apply the first spell $ 5 $ times and turn the sand into $ 1000 $ grams of lead. Then apply the second spell $ 4 $ times to get $ 600 $ grams of gold. Let’s take $ 400 $ grams from the resulting amount of gold turn them back into sand. We get $ 500 $ grams of sand and $ 200 $ grams of gold. If we apply the same operations to $ 500 $ grams of sand again, we can get extra $ 200 $ grams of gold every time. Thus, you can get $ 200 $ , $ 400 $ , $ 600 $ etc. grams of gold, i.e., starting with a finite amount of sand ( $ 500 $ grams), you can get the amount of gold which is greater than any preassigned number. In the forth sample it is impossible to get sand, or lead, or gold, applying the spells. In the fifth sample an infinitely large amount of gold can be obtained by using only the second spell, which allows you to receive $ 1 $ gram of gold out of nothing. Note that if such a second spell is available, then the first and the third one do not affect the answer at all. The seventh sample is more interesting. We can also start with a zero amount of sand there. With the aid of the third spell you can get sand out of nothing. We get $ 10000 $ grams of sand in this manner. Let's get $ 100 $ grams of lead using the first spell $ 100 $ times. Then make $ 1 $ gram of gold from them. We managed to receive $ 1 $ gram of gold, starting with a zero amount of sand! Clearly, in this manner you can get an infinitely large amount of gold.