import scala.annotation.tailrec
import scala.util.matching.Regex
object Main extends App {

  import scala.io.StdIn._

  val arg = readLine.trim
  val real = """^(\d+).(\d*)(\(\d+\))?$""".r
  val inLoop = """\((\d+)\)""".r
  println(arg match {
    case real(integer, null, null) ⇒ integer.toLong
    case real(integer, underPoint, null) ⇒ Rational((integer + underPoint).toLong, toInteger(underPoint).toLong)
    case real(integer, null, inLoop(loop)) ⇒ Rational((integer + loop).toLong - integer.toLong, toInteger(loop).toLong - 1)
    case real(integer, underPoint, inLoop(loop)) ⇒ Rational((integer + underPoint + loop).toLong - (integer + underPoint).toLong, toInteger(underPoint + loop).toLong - toInteger(underPoint).toLong)
    case _ ⇒ ???
  })
  def toInteger(underPoint: String): String = {
    s"1${underPoint.map{_ ⇒ "0"}.mkString}"
  }
  object Rational{
    def apply(numerator: Long, denominator: Long): Rational = {
      val signum = math.signum(numerator) * math.signum(denominator)
      val g = gcd(math.abs(numerator), math.abs(denominator))
      new Rational(math.abs(numerator) * signum / g, math.abs(denominator) / g)
    }
    def apply(integer: Long): Rational = Rational(integer, 1)
    def apply(integer: Int): Rational = Rational(integer, 1)
    @tailrec
    def gcd(a: Long, b: Long): Long = {
      b match {
        case 0 ⇒ a
        case _ ⇒ gcd(b, a % b)
      }
    }
  }
  
  class Rational private (val numerator: Long, val denominator: Long){
    override def toString: String = s"$numerator/$denominator"
    def +(that: Rational): Rational = Rational(numerator * that.denominator + denominator * that.numerator, denominator * that.denominator)
    def *(that: Rational): Rational = Rational(numerator * that.numerator, denominator * that.denominator)
    def -(that: Rational): Rational = this + (that * Rational(-1))
  }

  implicit class Extension[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}
