fun main(args: Array<String>) {
    val (A, B) = readLine()!!.split(" ").map(String::toInt)

    val diff = B - A

    for (i in 2..999) {
        val cur = (1..i).sum()
        val pre = (1..i - 1).sum()
        if (cur - pre == diff) {
            println(cur - B)
            return
        }
    }
}


