def debug(k,v) puts "#{k}: #{v}" end
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
 
def desc(ar) ar.sort!{|x,y|y<=>x} end #Using .sort.reverse instead decreases Exec Time but increases Memory Usage
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end
def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end 

INF = 10**11
A,B,Q = gsmi
s = Array.new(A){gi}
t = Array.new(B){gi}
x = Array.new(Q){gi}
[s,t].each{|arr| arr.unshift(-INF);arr.push(INF)}

x.each do |q|
	ans = []
	[[s,t],[t,s]].each do |arr|
		a,b = arr
		2.times do |i|
			apos = a.bsearch_index{|x|x>=q} - i
			ax = a[apos]
			2.times do |j|
				bpos = b.bsearch_index{|x|x>=ax} - j
				bx = b[bpos]
				ans << ((q - ax).abs + (ax - bx).abs)
			end
		end
	end
	puts ans.min
end