#include<set>
#include<queue>
#include<utility>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<numeric>
#include<functional>
#include<string>
#include<iostream>

using namespace std;
const int one = 1;
const int big = (one<<20);
typedef long long int llint;
bool solve(void){
	int d,n,m,h,ans=0,a,saki;
	vector<llint>tenpo;
	scanf("%d",&d);
	if(d==0){return false;}
	tenpo.push_back(0);
	tenpo.push_back(d);
	scanf("%d",&n);
	scanf("%d",&m);
	for(h=1;h<n;h++){
		scanf("%d",&a);
		tenpo.push_back(a);
	}
	sort(tenpo.begin(),tenpo.end());
	for(h=0;h<m;h++){
		scanf("%d",&saki);
		auto it=upper_bound(tenpo.begin(),tenpo.end(),saki);
		a=min(abs((*it)-saki),abs((*(it-1))-saki));
		ans+=a;
	}
	printf("%d\n",ans);
	return true;
}
int main(void){
	while(solve()){}
	return 0;
}