#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    ($arg:expr) => (println!("{:?}",$arg));
}


#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}


use std::cmp;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::cmp::Ordering;

pub trait BinarySearch<T> {
    fn lower_bound(&self, x: &T) -> usize;
    fn upper_bound(&self, x: &T) -> usize;
}



impl<T: Ord> BinarySearch<T> for [T] {
    fn lower_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less => {
                    low = mid + 1;
                }
                Ordering::Equal | Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }

    fn upper_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less | Ordering::Equal => {
                    low = mid + 1;
                }
                Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }
}



fn main() {

    input! { 
       a: usize,
       b: usize,
       q: usize,
       s_ : [i64;a],
       t_ : [i64;b],
       x : [i64;q],
    }

    let mut s_ = s_;
    let mut t_ = t_;
    s_.push(1000000000000_i64);
    t_.push(1000000000000_i64);
    
    
    let mut ans = vec![];


    for q_x in &x{
        let mut ans_x = 1000000000000_i64;
        let mut jinjya = vec![0;2];
        let mut tera = vec![0;2];
    
    
    
        let index = s_.lower_bound(q_x);
        jinjya[1] = s_[index];
        if(index<1){
            jinjya[0] = -1000000000000_i64;
        }
        else{
            jinjya[0] = s_[index-1];
        }
        

        let index = t_.lower_bound(q_x);
        tera[1] = t_[index];
        if(index<1){
            tera[0] = -1000000000000_i64;
        }
        else{
            tera[0] = t_[index-1];
        }
        



        //神社<- x ->寺  寺<- x ->神社 神社 <- 寺 <- x  寺 <- 神社 <- x 
        ans_x = cmp::min(ans_x , ((tera[0]- (*q_x))*2).abs() + (jinjya[1]- (*q_x)).abs());
        ans_x = cmp::min(ans_x , (tera[0]- (*q_x)).abs() + ((jinjya[1]- (*q_x))*2).abs());
        ans_x = cmp::min(ans_x , ((tera[1]- (*q_x))*2).abs() + (jinjya[0]- (*q_x)).abs());
        ans_x = cmp::min(ans_x , (tera[1]- (*q_x)).abs() + ((jinjya[0]- (*q_x))*2).abs());

        ans_x = cmp::min(ans_x , cmp::max((jinjya[0] - (*q_x)).abs() , (tera[0] - (*q_x)).abs()));
        ans_x = cmp::min(ans_x , cmp::max((jinjya[1] - (*q_x)).abs() , (tera[1] - (*q_x)).abs()));

        ans.push(ans_x);

        
    }

    









    
    for item in &ans{
        println!("{}",item);
    }


}


Measured memory_bytes: 16628