A, B, Q = gets.split(' ')
 
As = A.to_i.times.map { gets.to_i }
Bs = B.to_i.times.map { gets.to_i }
Qs = Q.to_i.times.map { gets.to_i }
 
INF = 10E18
 
As = [-INF] + As + [INF]
Bs = [-INF] + Bs + [INF]
 
Qs.each do |q|
  a = As.bsearch_index { |a| a > q }
  b = Bs.bsearch_index { |b| b > q } 
  puts As[a-1, 2].product(Bs[b-1, 2]).flat_map { |a, b| [(q - a).abs + (a - b).abs, (q - b).abs + (b - a).abs ] }.min
end