#include <bits/stdc++.h>
using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int d, n, m;
int D[110000], K[110000];

signed main() {
    while (true) {
        cin >> d;
        if (d == 0) break;
        cin >> n >> m;
        for (int i = 1; i < n; i++) cin >> D[i];
        for (int i = 0; i < m; i++) cin >> K[i];
        sort(D, D + n);
        int ans = 0;
        for (int i = 0; i < m; i++) {
            auto p = upper_bound(D, D + n, K[i]);
            int s = *(p - 1), t = (p == D + n ? d : *p);
            ans += min(K[i] - s, t - K[i]);
        }
        cout << ans << endl;
    }
}
