fun main(args: Array<String>) {
    val (A, B, Q) = listOfInt()
    val S = Array(A) { nextLong() }
    val T = Array(B) { nextLong() }
    repeat (Q) {
        var ans = Long.MAX_VALUE
        val X = nextLong()
        repeat(2) {
            val a : Array<Long>
            val b : Array<Long>
            if (it == 0) { a = S; b = T }
            else { a = T; b = S }
            repeat(2) {
                var aP = a.bsearch(X) + it
                if (aP == a.size) aP -= 1
                val ax = a[aP]
                repeat(2) {
                    var bP = b.bsearch(ax) + it
                    if (bP == b.size) bP -= 1
                    val bx = b[bP]
                    val d = Math.abs(X - ax) + Math.abs(bx - ax)
                    if (d < ans) ans = d
                }
            }
        }
        println(ans)
    }
}
fun next() = readLine()!!
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun Array<Long>.bsearch(x: Long): Int {
    var ok = 0
    var ng = this.size
    while (ng - ok > 1) {
        var m = (ok + ng) / 2
        if (this[m] <= x) ok = m else ng = m
    }
    return ok
}