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

int main(){
	long long int d;
	int n,m;
	long long int s[300003];
	while(cin >> d,d){
		cin >> n >> m;
		long long int res = 0;
		s[0] = 0ll;
		s[n] = d;
		s[2 * n] = 2 * d;
		for(int i = 1;i < n;i++) {
			cin >> s[i];
			s[i + n] = s[i] + d;
			s[i + 2 * n] = s[i] + 2 * d;
		}
		sort(s,s + 3 * n);
		for(int i = 0;i < m;i++){
			long long int a;
			cin >> a;
			int pos = lower_bound(s,s + 3 * n,a + d) - s;
			res += min(a + d - s[pos - 1],s[pos] - (a + d));
		}
		cout << res << endl;
	}
	return 0;	
}