has been goofing off in his Science 10 class, so he has no idea what complete combustion is! Not wanting to disappoint his teacher, who thinks could do better in the class if he tried, has decided to bother you into doing his homework.
The homework sheet involves balancing hundreds of complete combustion chemical equations. In his homework, only three types of atoms (elements) are involved:
- Carbon (represented by ~C~)
- Hydrogen (represented by ~H~)
- and Oxygen (represented by ~O~)
The general form of such an equation looks like this:
$$\displaystyle aR + bO_2 \to cCO_2 + dH_2O$$
~R~ can be any combination of carbon, hydrogen, or oxygen.
In order for the chemical equation to be balanced, the number of atoms of each element (~C~, ~H~, and ~O~) must be equal on both sides of the arrow, since atoms cannot be created or destroyed during the reaction. This can be done by setting ~a~, ~b~, ~c~, and ~d~ to some positive integer value, signifying the number of copies of the substance. A subscript in front of an element signifies the amount of that element in the substance. In the input and output, a subscript will simply be an integer after an element. If there is no subscript in front of an element, there is only one of it.
For example, ~2CH_3OH~ (
2CH3OH in input/output format) contains 2 carbon atoms, 8 hydrogen atoms, and 2 oxygen atoms.
Can you helpfinish his homework?
The first and only line of input will contain a single string, ~R~. It is guaranteed that ~R~ will not begin with a number and will only contain numbers,
The total amount of each element in ~R~ will not be greater than ~100\,000~.
On a single line, output the balanced chemical equation in the form of
aR + bO2 -> cCO2 + dH2O, where ~a~, ~b~, ~c~, and ~d~ are in lowest terms and cause the equation to be balanced, and ~R~ is the exact copy of what was given in the input.
If it is not possible to balance the equation, simply output
Sample Input 1
Sample Output 1
1CH3CH2CH3 + 5O2 -> 3CO2 + 4H2O
Sample Input 2
Sample Output 2
2CH3OH + 3O2 -> 2CO2 + 4H2O
Sample Input 3
Sample Output 3