#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

ll t[100002];
ll d,k,n,m,ans;

int main(){
  while(cin>>d&&d){
    cin>>n>>m;
    ans=0;
    for(int i=0;i<n-1;i++)cin>>t[i];
    t[n]=d;t[n-1]=0;
    n++;
    sort(t,t+n);
    for(int i=0;i<m;i++){
      cin>>k;
      ll* it = lower_bound(t,t+n,k);
      if(*it == k)continue;
      ans+= min( k - *(it-1) , *it - k );
    }
    cout<<ans<<endl;
  }
  return 0;
}