#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int d;
  while(cin>>d){
    if(d == 0)
      break;

    vector<int> v;
    v.push_back(0);
    v.push_back(-d);
    v.push_back(d);

    int n,m;
    cin>>n;
    cin>>m;
    for(int i = 1;i<n;i++){
      int tmp;
      cin>>tmp;
      v.push_back(tmp);
      v.push_back(tmp-d);
    }
    sort(v.begin(),v.end());

    int ans = 0;
    for(int i = 0;i<m;i++){
      int k;
      cin>>k;
      //cout<<"lower:"<<*(lower_bound(v.begin(),v.end(),k-d)-1)<<endl;
      ans += min(*lower_bound(v.begin(),v.end(),k)-k,k-(d+*(upper_bound(v.begin(),v.end(),k-d)-1)));
      //cout<<"ans:"<<ans<<endl;
    }

    cout<<ans<<endl;
  }
  return 0;
}