fun main(args: Array<String>){
    val arr = readLine()!!.split(" ").map { s->s.toInt() }
    val A=arr[0]
    val B=arr[1]
    val Q=arr[2]
    val s = Array(A){readLine()!!.toLong()}
    val t = Array(B){readLine()!!.toLong()}
    val result = mutableListOf<Long>()
    for(i in 0 until Q){
        val x = readLine()!!.toLong()
        val si = -s.binarySearch(x)-1
        val ti = -t.binarySearch(x)-1
        if(si<A&&ti<B){
            result.add(Math.max(s[si],t[ti])-x)
        }
        if(si>0&&ti>0){
            result.add(x-Math.min(s[si-1],t[ti-1]))
        }
        if(si<A&&ti>0){
            result.add(s[si]*2-t[ti-1]-x)
            result.add(x+s[si]-t[ti-1]*2)
        }
        if(si>0&&ti<B){
            result.add(t[ti]*2-s[si-1]-x)
            result.add(x+t[ti]-s[si-1]*2)
        }
        println(result.min())
        result.clear()
    }
}