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

s = [-1 << 36] + a.times.map {gets.to_i} + [1 << 36]
t = [-1 << 36] + b.times.map {gets.to_i} + [1 << 36]

q.times do
    x = gets.to_i

    i = s.bsearch_index{|e| e >= x}
    j = t.bsearch_index{|e| e >= x}

    p [x - [s[i-1], t[j-1]].min, 
       [s[i], t[j]].max - x,
       t[j] - s[i-1] + [x - s[i-1], t[j] - x].min, 
       s[i] - t[j-1] + [s[i] - x, x - t[j-1]].min].min
end