program lazy_faith
  implicit none
  integer(8)              :: a, b, q, n, x, i, k
  integer(8), allocatable :: s(:), t(:)
  read(*,*) a, b, q
  allocate(s(a),t(b))
  do i = 1, a
    read(*,*) s(i)
  end do
  do i = 1, b
    read(*,*) t(i)
  end do
  call merge_sort(a,s)
  call merge_sort(b,t)
  do k = 1, q
    read(*,*) x
    call answer(a,s,b,t,x)
  end do
  deallocate(s,t)
  stop
contains
  subroutine answer(a,s,b,t,x)
    implicit none
    integer(8), intent(in) :: a, s(a), b, t(b), x
    integer(8)             :: i, j, ms, mt, si, ti, m
    if (x .lt. min(s(1),t(1))) then
      write(*,'(i0)') max(s(1),t(1)) - x
      return
    end if
    if (x .gt. max(s(a),t(b))) then
      write(*,'(i0)') x - min(s(a),t(b))
      return
    end if
    ms = s(a) - s(1)
    do i = 1, a
      if (ms .gt. abs(x-s(i))) then
        si = s(i)
        ms = abs(x-s(i))
      end if
    end do
    mt = t(b) - t(1)
    do i = 1, b
      if (mt .gt. abs(si-t(i))) mt = abs(si-t(i))
    end do
    m = ms + mt

    mt = t(b) - t(1)
    do i = 1, b
      if (mt .gt. abs(x-t(i))) then
        ti = t(i)
        mt = abs(x-t(i))
      end if
    end do
    ms = s(a) - s(1)
    do i = 1, a
      if (ms .gt. abs(ti-s(i))) ms = abs(ti-s(i))
    end do

    write(*,'(i0)') min(m,ms+mt)
    return
  end subroutine answer

  subroutine merge_sort(n,c)
    implicit none
    integer(8), intent(in)    :: n
    integer(8), intent(inout) :: c(n)
    integer(8)                :: number, length, i, ubound
    number = n
    length = 1
    do while (number .gt. 1)
       do i = 1, number/2
          ubound = min(2*i*length,n)
          call merge(c(2*(i-1)*length+1:(2*i-1)*length),c((2*i-1)*length+1:ubound))
       end do
       length = 2*length
       number = (number+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(8)                :: 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
