#include<string.h>
#include<vector>
#include<queue>
#include<cstdio>
#include<math.h>
#include<algorithm>



using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
int map[10][10000];//0????????????



int main(){
	while(1){
		int d,n,m;//????????¨?????????????????°?????¨???????????°
		int N[100002];
		scanf("%d",&d);
		if(d==0)break;
		scanf("%d %d",&n,&m);

		N[0]=0;
		rep(i,n-1){scanf("%d",&N[i+1]);}
		sort(N,N+n);
		N[n]=d;//??¬?????????????°??????????
		long long int ans=0;
		rep(i,m){
			int t;
			scanf("%d",&t);
			int a=lower_bound(N,N+n+1,t)-N;
			if(a==0)ans+=N[a]-t;
			else{
				if(t-N[a-1]<=N[a]-t)ans+=t-N[a-1];
				else ans+=N[a]-t;
			}
		}
		printf("%lld\n",ans);
	}
}