def f(as,c1)
	if c1.nil? then
		return as.size-1
	elsif c1>0 then
		return c1-1
	else 
		return nil
	end
end

a,b,q=gets.split(" ")
as=[]
bs=[]

a.to_i.times{
	as<<(gets.to_i)
}
b.to_i.times{
	bs<<(gets.to_i)
}
as.sort!
bs.sort!
q.to_i.times{
	c= gets.to_i
	r1=as.bsearch_index{|x| x >= c}
	r2=bs.bsearch_index{|x| x >= c}
	l1=f(as,r1)
	l2=f(bs,r2)
	#p [c,l1,r1,l2,r2]
	ans=[]
	[l1,r1].each{|e1|
		[l2,r2].each{|e2|
			if e1.nil? == false && e2.nil? == false then
				c1=as[e1]
				c2=bs[e2]
				#p [c,c1,c2]
				ans<<((c1-c).abs+(c1-c2).abs)
				ans<<((c2-c).abs+(c2-c1).abs)
			end
		}
	}
	puts ans.min
}