m = gets.match(/(\d*)\.(\d*)\(?(\d*)\)?/)

d = m[1].to_i * (10 ** m[2].size) + m[2].to_i
n = 10 ** m[2].size
a = Rational(d, n)

d = m[3].to_i
n = 10 ** (m[2].size + m[3].size) - 10 ** m[2].size
n = 1 if n.zero?
b = Rational(d, n)

puts a + b