#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){

    int d;
    while(cin>>d,d){
        int n,m;
        cin>>n>>m;
        vector<int> S;
        int t;
        S.push_back(0);
        for(int i = 1;i < n;i++)cin>>t,S.push_back(t);
        S.push_back(d);
        vector<int> _S;
        for(int i = 0;i < S.size();i++){
            _S.push_back(-S[i]);
        }
        sort(S.begin(),S.end());sort(_S.begin(),_S.end());
        int ans = 0;
        for(int i = 0;i < m;i++){
            int x;
            cin>>x;
            vector<int>::iterator it = lower_bound(S.begin(),S.end(),x);
            int z = (*it) - x;
            it = lower_bound(_S.begin(),_S.end(),-x);
            z = min(z,x + (*it));
            ans += z;
        }
        cout<<ans<<endl;
    }

    return 0;
}