a,b,q=gets.split.map(&:to_i)
shrines=a.times.map{gets.to_i}
temples=b.times.map{gets.to_i}

LB=-10**15
RB=10**15
shrines.unshift LB
shrines.push RB
temples.unshift LB
temples.push RB

q.times{
  x=gets.to_i
  sidx=shrines.bsearch_index{|v|x<=v}
  tidx=temples.bsearch_index{|v|x<=v}
  ls=shrines[sidx-1]
  rs=shrines[sidx]
  lt=temples[tidx-1]
  rt=temples[tidx]

  lslt=x-[ls,lt].min
  rsrt=[rs,rt].max-x
  lsrt=rt-ls+[x-ls,rt-x].min
  rslt=rs-lt+[x-lt,rs-x].min

  puts [lslt,rsrt,lsrt,rslt].min
}