import java.io.BufferedReader
import java.util.*
import kotlin.math.max
import kotlin.math.min

fun main() = abc119d()

@OptIn(ExperimentalStdlibApi::class)
fun abc119d() = SimpleFastIOWithToken_abc119d().exec {
    val (a, b, q) = List(3) { readInt() }
    val shrines = LongArray(a) { readLong() }
    val temples = LongArray(b) { readLong() }

    fun LongArray.lowerBound(key: Long): Int {
        var ng = -1
        var ok = size

        while (ok - ng > 1) {
            val mid = (ok + ng) / 2
            if (this[mid] >= key) ok = mid else ng = mid
        }
        return ok
    }

    fun minOf(a: Long, b: Long, c: Long, d: Long) = min(min(a, b), min(c, d))

    val answer = StringBuilder()

    repeat(q) {
        val x = readLong()
        val rightShrineIndex = shrines.lowerBound(x)
        val rightTempleIndex = temples.lowerBound(x)
        val infinity = Long.MAX_VALUE / 100

        val leftShrine = if (rightShrineIndex - 1 in shrines.indices) shrines[rightShrineIndex - 1] else -infinity
        val rightShrine = if (rightShrineIndex in shrines.indices) shrines[rightShrineIndex] else infinity
        val leftTemple = if (rightTempleIndex - 1 in temples.indices) temples[rightTempleIndex - 1] else -infinity
        val rightTemple = if (rightTempleIndex in temples.indices) temples[rightTempleIndex] else infinity

        val min = minOf(
            // left shrine, left temple
            x - min(leftShrine, leftTemple),
            // left shrine, right temple
            rightTemple - leftShrine + min(rightTemple - x, x - leftShrine),
            // right shrine, left temple
            rightShrine - leftTemple + min(rightShrine - x, x - leftTemple),
            // right shrine, right temple
            max(rightShrine, rightTemple) - x
        )

        answer.appendln(min)
    }

    print(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_abc119d(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readLong(): Long = java.lang.Long.valueOf(readString())

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_abc119d.() -> Unit) {
        var t: Throwable? = null
        Thread(null, { action() }, "solve", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, t1 -> t = t1 } }
            .apply { start() }.join()
        t?.let { throw it }
        kotlin.io.print(sb)
    }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


Measured memory_bytes: 62504