시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 82 | 40 | 36 | 48.000% |
A sequinary numeral is a sequence of digits:
dndn-2...d1d0
where dn is 1 or 2 and the others are 0, 1, or 2.
It represents the rational number:
d0 + d1 * (3/2) + d2 * (3/2)2 + ... + dn * (3/2)n
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 32 digits.
Output consists of a single line.
If the result is an integer, the output is the decimal integer. Otherwise, the output is N a single space and K/M where N, K and M are decimal integers where K < M and K/M is in lowest terms (GCD(K, M) = 1).
2101
10
201
5 1/2