a,b,q = gets.split.map(&:to_i)
array=[]
qarray=[]
$parray=[]
a.times do |i|
  d = gets.to_i
  array.push([d,"S"])
end
b.times do
  d = gets.to_i
  array.push([d,"T"])
end
q.times do
  d = gets.to_i
  qarray.push(d)
end
array.sort!
array.each_index {|i|
  if i == array.size-1
    break
  end
  if array[i][1] != array[i+1][1]
    $parray.push([ array[i][0],array[i+1][0] ])
  end
}

middle = $parray.size/2
last = $parray[-1][1]

def binr(x,sep)
  if $parray[sep][0] > x
    binr(x,sep/2)
  elsif $parray[sep][0] < x
    if !$parray[sep+1]
      return sep
    elsif $parray[sep+1][0] > x
      return sep
    else
      if sep == 1
        binr(x,sep+1)
      else
        binr(x,sep + sep/2)
      end
    end
  else
    return sep
  end
end
# puts middle
# p $parray
# puts last
# puts binr(2000,1)

qarray.each { |num|
  ans = []
  # puts "---ans  #{num}"
  if num >= last
    puts num-$parray[-1][0]
  else
    i = binr(num,middle)
    if i != 0
      ans.push(num-$parray[i-1][0])
    end
    ans.push($parray[i][1]-$parray[i][0] +($parray[i][1]-num) )
    ans.push($parray[i][1]-$parray[i][0] -($parray[i][0]-num) )
    if $parray[i+1]
      ans.push($parray[i+1][1]-num)
    end
    ans.sort!
    puts ans[0]
    # p ans
    # puts
  end
}
