program abc119d
  implicit none
  integer a, b, q, i, si, ti
  integer(8) s1, s2, t1, t2, d(4)
  integer(8), dimension(:), allocatable :: s, t, x
  integer(8), parameter :: inf = 10_8**11

  read *, a, b, q
  allocate(s(a), t(b), x(q))
  read *, s, t, x
  s = [-inf, s, inf]
  t = [-inf, t, inf]
  do i = 1, q
     si = bsrch(s, x(i))
     ti = bsrch(t, x(i))
     s1 = x(i) - s(si - 1)
     s2 = s(si) - x(i)
     t1 = x(i) - t(ti - 1)
     t2 = t(ti) - x(i)
     d(1) = merge(s1, t1, s1 > t1)
     d(2) = merge(s2, t2, s2 > t2)
     d(3) = merge(s1 + t2 * 2, s1 * 2 + t2, s1 > t2)
     d(4) = merge(t1 + s2 * 2, t1 * 2 + s2, t1 > s2)
     print *, minval(d)
  end do
contains
  integer function bsrch(ary, v)
    integer(8), intent(in) :: ary(:), v
    integer low, mid, high

    low = lbound(ary, 1)
    high = ubound(ary, 1)

    do while (low < high)
       mid = low + (high - low) / 2
       if (ary(mid) < v) then
          low = mid + 1
       else
          high = mid
       end if
    end do
    bsrch = low
  end function bsrch
end program abc119d
