program lazy_faith
  implicit none
  integer    :: a, b, q, i, k
  integer(8) :: s(0:100001), t(0:100001), x
  integer(8) :: infty = 10_8**12_8
  read(*,*) a, b, q
  s(0) = -infty
  do i = 1, a
    read(*,*) s(i)
  end do
  s(a+1) = infty
  t(0) = -infty
  do i = 1, b
    read(*,*) t(i)
  end do
  t(b+1) = infty
  call merge_sort(a,s(1:a))
  call merge_sort(b,t(1:b))
  do k = 1, q
    read(*,*) x
    call answer(a,s,b,t,x)
  end do
  stop
contains
  subroutine answer(a,s,b,t,x)
    implicit none
    integer, intent(in)    :: a, b
    integer(8), intent(in) :: s(0:a+1), t(0:b+1), x
    integer                :: i, j
    integer(8)             :: m(4)
    i = bisearch(a,s,x)
    j = bisearch(b,t,x)
    m(1) = min(abs(s(i  )-x),abs(t(j  )-x)) + abs(s(i  )-t(j  ))
    m(2) = min(abs(s(i  )-x),abs(t(j-1)-x)) + abs(s(i  )-t(j-1))
    m(3) = min(abs(s(i-1)-x),abs(t(j  )-x)) + abs(s(i-1)-t(j  ))
    m(4) = min(abs(s(i-1)-x),abs(t(j-1)-x)) + abs(s(i-1)-t(j-1))
    write(*,'(i0)') minval(m)
    return
  end subroutine answer

  !min{i | x < y(i)}
  function bisearch(n,c,x) result(idx)
    implicit none
    integer, intent(in)    :: n
    integer(8), intent(in) :: c(0:n+1), x
    integer                :: idx, i, btm, top, mid
    btm = 0
    top = n+1
    do while (top-btm.gt.1)
      mid = (btm+top)/2
      if (x.lt.c(mid)) then
        top = mid
      else
        btm = mid
      end if
    end do
    idx = top
    return
  end function bisearch

  subroutine merge_sort(n,c)
    implicit none
    integer, intent(in)       :: n
    integer(8), intent(inout) :: c(n)
    integer                   :: num, lng, i, ubnd
    num = n
    lng = 1
    do while (num.gt.1)
      do i = 1, num/2
        ubnd = min(2*i*lng,n)
        call merge(c(2*(i-1)*lng+1:(2*i-1)*lng),c((2*i-1)*lng+1:ubnd))
      end do
      lng = 2*lng
      num = (num+1)/2
    end do
    return
  end subroutine merge_sort

  subroutine merge(c1,c2)
    implicit none
    integer(8), intent(inout) :: c1(:), c2(:)
    integer(8)                :: c(size(c1)+size(c2))
    integer                   :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1)
    n2 = size(c2)
    do while (i1.le.n1.and.i2.le.n2)
      if (c1(i1).le.c2(i2)) then
        c(i1+i2-1) = c1(i1)
        i1 = i1+1
      else
        c(i1+i2-1) = c2(i2)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2) = c1(i1:n1)
    else if (i2.le.n2) then
      c(i1+i2-1:n1+n2) = c2(i2:n2)
    end if
    c1 = c(1:n1)
    c2 = c(n1+1:n1+n2)
    return
  end subroutine merge
end program lazy_faith