class Array
	def bsearch(l = 0, r = size - 1, &pred)
		if r - l < 10
			return (l..r).find{|j| pred[self[j]]}
		end 
		c = (l + r) / 2 
		if pred[self[c]]
			bsearch(l, c-1, &pred) || c
		else
			bsearch(c+1, r, &pred)
		end
	end
end

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
}