A sequinary numeral is a sequence of digits:
where

is

or

and the others are

, or

.
It represents the rational number:
Write a program which takes a sequinary numeral as input and returns the number it represents as a proper fraction.
输入描述:
The single line of input contains a sequinary numeral of no more than
digits.
输出描述:
Output consists of a single line.
If the result is an integer, the output is the decimal integer. Otherwise, the output is

a single space and

where

,

and

are decimal integers where

and

is in lowest terms (
%3D%201)
).