object Main extends App {
  import scala.io.StdIn._

  val Array(a, b, q) = readLine.trim.split(' ').map(_.toInt)
  val shrine = Array.tabulate(a){_ ⇒ readLong}
  val temple = Array.tabulate(b){_ ⇒ readLong}
  for (_ ← 0 until q){
    val x = readLong
    val sl = moveToLeft(x, shrine)
    val sr: Option[Long] = moveToRight(x, shrine)
    val tr: Option[Long] = moveToRight(x, temple)
    val tl: Option[Long] = moveToLeft(x, temple)

    println(List(
      sl.flatMap(l ⇒ tr.map(r ⇒ l + r + math.min(l, r))),
      sl.flatMap(l ⇒ tl.map(r ⇒ math.max(l, r))),
      sr.flatMap(l ⇒ tr.map(r ⇒ math.max(l, r))),
      sr.flatMap(l ⇒ tl.map(r ⇒ l + r + math.min(l, r)))
    ).flatten.min)
  }
  def moveToRight(from: Long, positions: Array[Long]): Option[Long]  = {
    val pos = lowerBound(positions, from)
    if (positions.indices.contains(pos)) Some(positions(pos) - from)
    else None
  }
  def moveToLeft(from: Long, positions: Array[Long]): Option[Long] = {
    val pos = lowerBound(positions, from)
    if (positions.indices.contains(pos) && positions(pos) == from) Some(0)
    else if (positions.indices.contains(pos - 1)) Some(from - positions(pos - 1))
    else None
  }
  def lowerBound(array: Array[Long], target: Long): Int = {
    var left = 0
    var right = array.length
    while(left < right){
      val mid = (left + right) / 2
      if (array(mid) < target){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }
}