loop {
    d = gets.to_i
    break if d == 0
    n = gets.to_i
    m = gets.to_i
    shop = [0] + (2..n).map{ gets.to_i }.sort + [d] 
    total = 0   
    (1..m).each{
        o = gets.to_i
        i = shop.bsearch{|x| x > o}  
        total += [o - shop[i-1], shop[i] - o].min
    }
    p total
}