#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll = long long;

vector<ll> store;

int main(void){
	ll d,n,m;
	while(cin >> d,d){
		cin >> n >> m;
		store.clear();
		store.push_back(0);
		store.push_back(d);
		
		rep(i,n-1){
			ll arg;
			cin >> arg;
			store.push_back(arg);
		}

		sort(store.begin(),store.end());
		ll ans=0LL;

		rep(i,m){
			ll h;
			cin >> h;
			int idx=lower_bound(store.begin(),store.end(),h)-store.begin();
			ans+=min(abs(h-store[idx]),abs(h-store[idx-1]));
		}
		cout << ans << endl;
	}
	return 0;
}