#!/usr/bin/env ruby

(a, b, q) = gets.chomp.split(/ /).map(&:to_i)

s = []
a.times do
  s << gets.chomp.to_i
end

t = []
b.times do
  t << gets.chomp.to_i
end

x = []
q.times do
  x << gets.chomp.to_i
end

x.each do |p|
  (mina, minb, maxa, maxb) = [0, 0, 0, 0]
  s.each do |ap|
    mina = ap if ap < p
    maxa = ap if (ap > p && maxa == 0)
  end
  t.each do |bp|
    minb = bp if bp < p
    maxb = bp if bp  > p && maxb == 0
  end


  res = (10**10) * 2
#  puts "s:#{res}"
  if mina != 0 && maxb != 0
    res = [res, (mina - p).abs * 2 + (maxb - p).abs].min
#    puts "1:#{res}"
  end
  if minb != 0 && maxa != 0
    res = [res, (minb - p).abs * 2 + (maxa - p).abs].min
#    puts "2:#{res}"
  end
  if maxa != 0 && minb != 0
    res = [res, (maxa - p).abs * 2 + (minb - p).abs].min
#    puts "3:#{res}"
  end
  if maxb != 0 && mina != 0
    res = [res, (maxb - p).abs * 2 + (mina - p).abs].min
#    puts "4:#{res}"
  end

  if (mina != 0 && minb != 0)
    if (mina < minb)
      res = [res, (mina - p).abs].min
#    puts "5:#{res}"
    else
      res = [res, (minb - p).abs].min
#    puts "6:#{res}"
    end
  end
  if (maxa != 0 && maxb != 0)
    if (maxa > maxb)
      res = [res, (maxa - p).abs].min
#    puts "7:#{res}"
    else
      res = [res, (maxb - p).abs].min
#    puts "8:#{res}"
    end
  end
  puts res
end


