#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int D;

int dist(int a, int b){
	return min( abs(a-b) , abs(D-abs(a-b)) );
}

int search(vector<int>& v, int k){
	int low = 0, high = v.size();
	while( high - low > 1 ){
		int mid = (low + high) / 2;
		if( v[mid] > k ){
			high = mid;
		}else{
			low = mid;
		} 
	}
	return min( abs(v[low]-k) , abs(v[high]-k) );
}

int main(){
	int N, M;
	while( cin >> D , D){
		cin >> N >> M;
	
		vector<int> d(N+1), k(M);
		d[0] = 0;
		d[N] = D;
		for(int i=1 ; i < N ; i++ ){
			cin >> d[i];
		}
		for(int i=0 ; i < M ; i++ ){
			cin >> k[i];
		}
		sort( d.begin() , d.end() );
		sort( k.begin() , k.end() );
		int ans=0;
		for(int i=0 ; i < M ; i++ ){
			ans += search( d , k[i] );
		}
		cout << ans << endl;
	}
}