import java.lang.Math.*

data class Approx(val : Double, val : Double = 0.0) {
    constructor(a: Approx) : this(a., a.)
    constructor(n: Number) : this(n.toDouble(), 0.0)

    override fun toString() = "$ $"

    operator infix fun plus(a: Approx) = Approx( + a., sqrt( *  + a. * a.))
    operator infix fun plus(d: Double) = Approx( + d, )
    operator infix fun minus(a: Approx) = Approx( - a., sqrt( *  + a. * a.))
    operator infix fun minus(d: Double) = Approx( - d, )

    operator infix fun times(a: Approx): Approx {
        val v =  * a.
        return Approx(v, sqrt(v * v *  *  / ( * ) + a. * a. / (a. * a.)))
    }

    operator infix fun times(d: Double) = Approx( * d, abs(d * ))

    operator infix fun div(a: Approx): Approx {
        val v =  / a.
        return Approx(v, sqrt(v * v *  *  / ( * ) + a. * a. / (a. * a.)))
    }

    operator infix fun div(d: Double) = Approx( / d, abs(d * ))

    fun pow(d: Double): Approx {
        val v = pow(, d)
        return Approx(v, abs(v * d *  / ))
    }
}

fun main(args: Array<String>) {
    val x1 = Approx(100.0, 1.1)
    val y1 = Approx(50.0, 1.2)
    val x2 = Approx(200.0, 2.2)
    val y2 = Approx(100.0, 2.3)
    println(((x1 - x2).pow(2.0) + (y1 - y2).pow(2.0)).pow(0.5))
}