DBG = !true
BIG = 99999999999
a,b,q = gets.split.map{|z| z.to_i}
s = []
t = []
for i in 0...a
  s << gets.to_i
end
for i in 0...b
  t << gets.to_i
end

for i in 0...q
  x = gets.to_i
  mn = BIG

  p = s.bsearch_index{|z| z>=x}
  p = a-1 if p.nil?
  puts "-- x #{x} p #{p}" if DBG
  if s[p] == x && false
    q = t.bsearch_index{|z| z>=x}
    q = b-1 if q.nil?
    mn = (t[q]-x).abs
    mn = (t[q-1]-x).abs if q>0 && (t[q-1]-x).abs < mn
  else
    q = t.bsearch_index{|z| z>=s[p]}
    q = b-1 if q.nil?
    mid = (s[p]-x).abs
    v = mid + (t[q]-s[p]).abs
    puts "1. q #{q} mid #{mid} v #{v} " if DBG
    mn = v if v < mn
    if q>0
      v = mid + (t[q-1]-s[p]).abs
      puts "2. q #{q} mid #{mid} v #{v} " if DBG
      mn = v if v < mn
    end

    if p>0
      q = t.bsearch_index{|z| z>=s[p-1]}
      q = b-1 if q.nil?
      mid = (s[p-1]-x).abs
      v = mid + (t[q]-s[p-1]).abs
      puts "3. q #{q} mid #{mid} v #{v} " if DBG
      mn = v if v < mn
      if q>0
        v = mid + (t[q-1]-s[p-1]).abs
        puts "4. q #{q} mid #{mid} v #{v} " if DBG
        mn = v if v < mn
      end
    end

  end

   # # #

  q = t.bsearch_index{|z| z>=x}
  q = b-1 if q.nil?
  puts "== x #{x} q #{q}" if DBG
  if t[q] == x && false
    q = t.bsearch_index{|z| z>=x}
    q = b-1 if q.nil?
    mn = (t[q]-x).abs
    mn = (t[q-1]-x).abs if q>0 && (t[q-1]-x).abs < mn
  else
    p = s.bsearch_index{|z| z>=t[q]}
    p = a-1 if p.nil?
    mid = (t[q]-x).abs
    v = mid + (t[q]-s[p]).abs
    puts "1. p #{p} mid #{mid} v #{v} " if DBG
    mn = v if v < mn
    if p>0
      v = mid + (t[q]-s[p-1]).abs
      puts "2. p #{p} mid #{mid} v #{v} " if DBG
      mn = v if v < mn
    end

    if q>0
      p = s.bsearch_index{|z| z>=t[q-1]}
      p = a-1 if p.nil?
      mid = (t[q-1]-x).abs
      v = mid + (t[q-1]-s[p]).abs
      puts "3. p #{p} mid #{mid} v #{v} " if DBG
      mn = v if v < mn
      if p>0
        v = mid + (t[q-1]-s[p-1]).abs
        puts "4. p #{p} mid #{mid} v #{v} " if DBG
        mn = v if v < mn
      end
    end

  end


  puts "#{mn}"
end
