#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using piii = pair<int, pii>;
using plll = pair<ll, pll>;
using pib = pair<int, bool>;
using pdi = pair<double, int>;
using pid = pair<int, double>;
using ld = long double;
using piiii = pair<pii, pii>;

#define endl "\n"
#define inf 0x3f3f3f3f3f
#define f first
#define s second

int n, m, k, q, x, y;
ll dp[200001][2], c[200001][2];
vector<int>  val, col, arr[200001];

int mindist(int r1, int s, int r2, int d){
    if (r1==r2) return abs(s-d);
    if (s<=d){
        int idx = lower_bound(col.begin(), col.end(), d)-col.begin();
        if (col[idx]>d&&idx>0) idx--;
        return abs(col[idx]-s)+abs(col[idx]-d);
    }else{
        int idx = lower_bound(col.begin(), col.end(), d)-col.begin();
        return abs(col[idx]-s)+abs(col[idx]-d);
    };
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> k >> q;
    for (int i=0; i<k; i++){
        cin >> x >> y;
        val.push_back(x);
        arr[x].push_back(y);
    }
    sort(val.begin(), val.end());
    val.erase(unique(val.begin(), val.end()), val.end());
    for (int i=0; i<q; i++){
        cin >> x;
        col.push_back(x);
    }
    for (int i=1; i<=n; i++){
        sort(arr[i].begin(), arr[i].end());
    }
    sort(col.begin(), col.end());
    memset(dp, inf, sizeof dp);
    dp[0][0] = dp[0][1] = 0;
    c[0][0] = c[0][1] = 1;
    int prev = 1;
    for (int i=1; i<=val.size(); i++){
        int cur = val[i-1];
        int l = arr[i][0];
        int r = arr[i][arr[i].size()-1];
        dp[i][0] = max(dp[i-1][0]+mindist(prev, c[i-1][0], cur, r), dp[i-1][1]+mindist(prev, c[i-1][1], cur, r))+r-l+cur-prev;
        c[i][0] = l;
        dp[i][1] = max(dp[i-1][0]+mindist(prev, c[i-1][0], cur, l), dp[i-1][1]+mindist(prev, c[i-1][1], cur,  l))+r-l+cur-prev;
        c[i][1] = r;
        prev = cur;
    }
    cout << min(dp[val.size()][0], dp[val.size()][1]) << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using piii = pair<int, pii>;
using plll = pair<ll, pll>;
using pib = pair<int, bool>;
using pdi = pair<double, int>;
using pid = pair<int, double>;
using ld = long double;
using piiii = pair<pii, pii>;

#define endl "\n"
#define inf 0x3f3f3f3f3f
#define f first
#define s second

int n, m, k, q, x, y;
ll dp[200001][2], c[200001][2];
vector<int>  val, col, arr[200001];

ll mindist(int r1, int s, int r2, int d){
    if (r1==r2) return abs(s-d);
    int lo = 0;
    int hi = col.size()-1;
    while (lo<=hi){
        int mid = (lo+hi)/2;
        if (col[mid]<=d) lo = mid+1;
        else hi = mid-1;
    }
    int low = lo-1;
    int high = lo;
    if (lo<0){
        return abs(s-col[high])+abs(d-col[high]);
    }
    else if (high>=col.size()){
        return abs(s-col[low])+abs(d-col[low]);
    }else{
        return min(abs(s-col[low])+abs(d-col[low]), abs(s-col[high])+abs(d-col[high]));
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> k >> q;
    for (int i=0; i<k; i++){
        cin >> x >> y;
        val.push_back(x);
        arr[x].push_back(y);
    }
    sort(val.begin(), val.end());
    val.erase(unique(val.begin(), val.end()), val.end());
    for (int i=0; i<q; i++){
        cin >> x;
        col.push_back(x);
    }
    for (int i=1; i<=n; i++){
        sort(arr[i].begin(), arr[i].end());
    }
    sort(col.begin(), col.end());
    memset(dp, inf, sizeof dp);
    dp[0][0] = dp[0][1] = 0;
    c[0][0] = c[0][1] = 1;
    ll prev = 1;
    for (int i=1; i<=val.size(); i++){
        ll cur = val[i-1];
        ll l = arr[cur][0];
        ll r = arr[cur][arr[cur].size()-1];
        dp[i][0] = min(dp[i-1][0]+mindist(prev, c[i-1][0], cur, r), dp[i-1][1]+mindist(prev, c[i-1][1], cur, r))+r-l+cur-prev;
        c[i][0] = l;
        dp[i][1] = min(dp[i-1][0]+mindist(prev, c[i-1][0], cur, l), dp[i-1][1]+mindist(prev, c[i-1][1], cur,  l))+r-l+cur-prev;
        c[i][1] = r;
        prev = cur;
    }
    cout << min(dp[val.size()][0], dp[val.size()][1]) << endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = m + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n + 1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = n; i > 0; i--)
        {
            if(pnt[i][0] == m + 1 && pnt[i][1] == -1)
            {
                for(int j = 0; j < 4; j++) path[i][j] = path[i + 1][j];
                continue;
            }
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;

            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;

            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;

            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {

                 if(dp[i + 1][j] >= INF) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(x == m + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    if(ans >= INF) continue;
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = n + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n + 1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = 1; i <= n; i++)
        {
            //if(pnt[i][0] == n + 1 && pnt[i][1] == -1) continue;
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;

            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;

            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;

            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {

                 if(dp[i + 1][j] >= INF) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(x == n + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    if(ans >= INF) continue;
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = n + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n + 1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = n; i > 0; i--)
        {
            if(pnt[i][0] == n + 1 && pnt[i][1] == -1)
            {
                for(int j = 0; j < 4; j++) path[i][j] = path[i + 1][j];
                continue;
            }
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;

            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;

            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;

            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {

                 if(dp[i + 1][j] >= INF) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(x == n + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    if(ans >= INF) continue;
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = n + 1, pnt[i][1] = -1;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n+1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = 1; i <= n; i++)
        {
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;
            else path[i][0] = 0;
            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;
            else path[i][1] = 0;
            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;
            else path[i][2] = 0;
            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
            else path[i][3] = 0;
        }
        while(n > 0)
        {
            if(pnt[n][0] == n + 1 && pnt[n][1] == -1)
                n--;
            else break;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            for(int j = 0; j < 4; j++)
            {
                 if(path[i + 1][j] == 0) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(path[i][z] == 0) continue;
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = n + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n+1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = 1; i <= n; i++)
        {
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;
            else path[i][0] = 0;
            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;
            else path[i][1] = 0;
            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;
            else path[i][2] = 0;
            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
            else path[i][3] = 0;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            for(int j = 0; j < 4; j++)
            {
                 if(path[i + 1][j] == 0) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(path[i][z] == 0) continue;
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = n + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n + 1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = 1; i <= n; i++)
        {
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;
            else path[i][0] = 0;
            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;
            else path[i][1] = 0;
            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;
            else path[i][2] = 0;
            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
            else path[i][3] = 0;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {

                 if(path[i + 1][j] == 0 || dp[i + 1][j] >= INF) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(path[i][z] == 0) continue;
                    if(x == n + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    if(ans >= INF) continue;
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = m + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n + 1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = n; i > 1; i--)
        {
            if(pnt[i][0] == m + 1 && pnt[i][1] == -1)
            {
                for(int j = 0; j < 4; j++) path[i][j] = path[i + 1][j];
                continue;
            }
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;

            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;

            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;

            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
        }
        if(n > 0)
        {
            path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        for(int i = n - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {
                 if(path[i + 1][j] == 0) continue;
                 if(dp[i + 1][j] >= INF) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(path[i][z] == 0) continue;
                    if(x == m + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    if(ans >= INF) continue;
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = n + 1, pnt[i][1] = -1;
        n = 0;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            n = max(r, n);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        set<ll> b_inc;
        set<ll,greater<ll>> b_dec;
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc.insert(x);
            b_dec.insert(x);
        }
        ll dp[n + 1][4], path[n + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= n; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = 1; i <= n; i++)
        {
            auto it = b_dec.lower_bound(pnt[i][0]);
            if(it != b_dec.end())
            path[i][0] = *it;
            else path[i][0] = 0;
            auto it2 = b_inc.lower_bound(pnt[i][0]);
            if(it2 != b_inc.end())
            path[i][1] = *it2;
            else path[i][1] = 0;
            it = b_dec.lower_bound(pnt[i][1]);
            if(it != b_dec.end())
            path[i][2] = *it;
            else path[i][2] = 0;
            it2 = b_inc.lower_bound(pnt[i][1]);
            if(it2 != b_inc.end())
            path[i][3] = *it2;
            else path[i][3] = 0;
        }
        if(n > 0)
        {
            for(int i = 0; i < 4; i++)
            {
                if(path[n][i] != 0)
                {
                    dp[n][i] = pnt[n][1] - pnt[n][0];
                    dp[n][i] += min(abs(path[n][i] - pnt[n][0]) , abs(path[n][i] - pnt[n][1]));
                }
            }
        }
        else dp[1][0] = 0;
        path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
        for(int i = n - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {
                 if(path[i + 1][j] == 0) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(path[i][z] == 0) continue;
                    if(x == n + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ss second
#define ff first
#define INF 10000000000000001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll ;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m, k ,q, r, c, x, y, u = 0;
        cin >> n >> m >> k >> q;
        ll pnt[n + 1][2];
        for(int i = 0; i <= n; i++) pnt[i][0] = m + 1, pnt[i][1] = -1;
        for(int i = 0; i < k; i++)
        {
            cin >> r >> c;
            u = max(r, u);
            pnt[r][0] = min(pnt[r][0], c);
            pnt[r][1] = max(pnt[r][1], c);
        }
        ll b_inc[m + 1] = {};
        ll b_dec[m + 1] = {};
        for(int i = 0; i < q; i++)
        {
            cin >> x;
            b_inc[x] = x;
            b_dec[x] = x;
        }
        ll last = 0;
        for(int i = 1; i <= m; i++)
        {
            if(b_inc[i] == 0)
            {
                b_inc[i] = last;
            }
            else last = b_inc[i];
        }last = 0;
        for(int i = m; i > 0; i--)
        {
            if(b_dec[i] == 0)
            {
                b_dec[i] = last;
            }
            else last = b_dec[i];
        }
        ll dp[u + 1][4], path[u + 1][4];
        memset(path,0,sizeof(path));
        for(int i = 0; i <= u; i++)
        {
            for(int j = 0; j < 4; j++) dp[i][j] = INF;
        }
        for(int i = u; i > 1; i--)
        {
            if(pnt[i][0] == m + 1 && pnt[i][1] == -1)
            {
                for(int j = 0; j < 4; j++) path[i][j] = path[i + 1][j];
                continue;
            }
            path[i][0] = b_inc[pnt[i][0]];
            path[i][1] = b_dec[pnt[i][0]];
            path[i][2] = b_inc[pnt[i][1]];
            path[i][3] = b_dec[pnt[i][1]];
        }
        if(u > 0)
        {
            path[1][0] = path[1][1] = path[1][2] = path[1][3] = 1;
            for(int i = 0; i < 4; i++)
            {
                if(path[u][i] != 0)
                {
                    dp[u][i] = pnt[u][1] - pnt[u][0];
                    dp[u][i] += min(abs(path[u][i] - pnt[u][0]) , abs(path[u][i] - pnt[u][1]));
                }
            }
        }
        else dp[1][0] = 0;
        for(int i = u - 1; i > 0; i--)
        {
            x = pnt[i][0];
            y = pnt[i][1];
            for(int j = 0; j < 4; j++)
            {

                 if(dp[i + 1][j] >= INF || path[i + 1][j] == 0) continue;
                 for(int z = 0; z < 4; z++)
                 {
                    if(x == m + 1 && y == -1)
                        pnt[i][0] = path[i][z],pnt[i][1] = path[i][z];
                    ll ans = INF;
                    if(path[i + 1][j] >= pnt[i][1])
                    ans = abs(path[i + 1][j] - pnt[i][0]) + abs(path[i][z] - pnt[i][0]);
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][0]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][1]));
                    if(path[i + 1][j] <= pnt[i][0])
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + abs(path[i][z] - pnt[i][1]));
                    ans = min(ans, abs(path[i + 1][j] - pnt[i][1]) + pnt[i][1] - pnt[i][0] + abs(path[i][z] - pnt[i][0]));
                    if(ans >= INF || path[i][z] == 0) continue;
                    dp[i][z] = min(ans + dp[i + 1][j] + 1, dp[i][z]);
                    pnt[i][0] = x;
                    pnt[i][1] = y;
                 }
            }
        }
        for(int i = 1; i < 4; i++) dp[1][0] = min(dp[1][0], dp[1][i]);
        cout << dp[1][0] << "\n";
    }
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= k; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+q+1);
        in[0] = -INF, in[q+1] = INF;
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+q+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+q+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
            a[1].l = a[1].r;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = a[1].r = 1;
        }
        //for(int i = 1; i <= n; i++) printf("-- %d %d\n", a[i].l,a[i].r);
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                //printf("%d : %d %d %d %d %d\n",i, res1,res2,res3,res4,s);
                f[i][0] = min(res2,res4) + s;
                f[i][1] = min(res1,res3) + s;
                fl = i;
            }
        }
        printf("%lld\n", min(f[fl][0],f[fl][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= k; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+q+1);
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+q+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+q+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = 1, a[1].r = 1;
        }
        //for(int i = 1; i <= n; i++) printf("-- %d %d\n", a[i].l,a[i].r);
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                //printf("%d : %d %d %d %d %d\n",i, res1,res2,res3,res4,s);
                f[i][0] = min(res2,res4) + s;
                f[i][1] = min(res1,res3) + s;
                fl = i;
            }
        }
        printf("%lld\n", min(f[fl][0],f[fl][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= k; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+q+1);
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+n+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+n+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = 1, a[1].r = 1;
        }
        //for(int i = 1; i <= n; i++) printf("-- %d %d\n", a[i].l,a[i].r);
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                //printf("%d : %d %d %d %d %d\n",i, res1,res2,res3,res4,s);
                f[i][0] = min(res2,res4) + s;
                f[i][1] = min(res1,res3) + s;
                fl = i;
            }
        }
        printf("%lld\n", min(f[fl][0],f[fl][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= k; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+q+1);
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+q+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+q+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
            a[1].l = a[1].r;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = 1, a[1].r = 1;
        }
        //for(int i = 1; i <= n; i++) printf("-- %d %d\n", a[i].l,a[i].r);
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                //printf("%d : %d %d %d %d %d\n",i, res1,res2,res3,res4,s);
                f[i][0] = min(res2,res4) + s;
                f[i][1] = min(res1,res3) + s;
                fl = i;
            }
        }
        printf("%lld\n", min(f[fl][0],f[fl][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= n; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+n+1);
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+n+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+n+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = 1, a[1].r = 1;
        }
        //printf("%d %d %d %d\n", f[n][0],f[n][1],f[1][1],f[1][0]);
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                f[i][0] = min(res1,res3) + s;
                f[i][1] = min(res2,res4) + s;
                fl = i;
            }
        }
        //printf("%lld\n", min(f[n-1][0],f[n-1][1]));
        printf("%lld\n", min(f[fl][0],f[fl][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= n; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+n+1);
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+n+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+n+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = 1, a[1].r = 1;
        }
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                f[i][0] = min(res1,res3) + s;
                f[i][1] = min(res2,res4) + s;
                fl = i;
            }
        }
        //printf("%lld\n", min(f[n-1][0],f[n-1][1]));
        printf("%lld\n", min(f[n][0],f[n][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
//  Date : 2019.08.10 21:10:06 August Saturday
//  Author : Sakii
//  website : zcqiever.tk
//  I'm so vegetable , QAQ..
//≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈

#include<bits/stdc++.h>
#define re register
#define il inline
#define lowbit(x) x&(-x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

template <class T> inline void read(T &s){
    s = 0; re char ch = getchar(); re int w = 0;
    while(!isdigit(ch)) w |= ch == '-', ch = getchar();
    while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    if(w) s = -s;
}

namespace Sakii {
    const int N = 2e5 + 10;
    const int INF = 2147483647;
    ll n,m,k,q,ls[N],rs[N],in[N],f[N][2];

    struct node {
        int l,r;
    }a[N];

    il ll sum(ll a,ll b,ll c) {
        return abs(a-c) + abs(b-c);
    }

    il ll dis(int a,int b, int x, int y) {
        ll xx = abs(a-x);
        ll yy = min(min(sum(b,y,ls[y]),sum(b,y,ls[b])),min(sum(b,y,rs[b]),sum(b,y,rs[y])));
        return xx + yy;
    }

    il int check(node a) {
        if(a.l!=INF && a.r!=0) return 1;
        return 0;
    }

    il void main() {
        read(n); read(m); read(k); read(q);
        for(int i = 1; i <= n; i++) a[i].l = INF, a[i].r = 0;
        for(int i = 1; i <= k; i++) {
            int rr,c;
            read(rr); read(c);
            a[rr].l = min(a[rr].l,c);
            a[rr].r = max(a[rr].r,c);
        }
        for(int i = 1; i <= q; i++) read(in[i]);
        sort(in+1,in+q+1);
        //in[0] = -INF, in[q+1] = INF;
        for(int i = 1; i <= m; i++) {
            ls[i] = in[lower_bound(in+1,in+q+1,i) - in - 1];
            rs[i] = in[lower_bound(in+1,in+q+1,i) - in];
        }
        if(check(a[1])) {
            f[1][0] = f[1][1] = a[1].r - 1;
            a[1].l = a[1].r;
        }
        else {
            f[1][0] = f[1][1] = 0;
            a[1].l = a[1].r = 1;
        }
        //for(int i = 1; i <= n; i++) printf("-- %d %d\n", a[i].l,a[i].r);
        int fl = 1;
        for(int i = 2; i <= n; i++) {
            if(check(a[i])) {
                ll res1 = f[fl][0] + dis(fl,a[fl].l,i,a[i].l);
                ll res2 = f[fl][0] + dis(fl,a[fl].l,i,a[i].r);
                ll res3 = f[fl][1] + dis(fl,a[fl].r,i,a[i].l);
                ll res4 = f[fl][1] + dis(fl,a[fl].r,i,a[i].r);
                ll s = a[i].r - a[i].l;
                //printf("%d : %d %d %d %d %d\n",i, res1,res2,res3,res4,s);
                f[i][0] = min(res2,res4) + s;
                f[i][1] = min(res1,res3) + s;
                fl = i;
            }
        }
        printf("%lld\n", min(f[fl][0],f[fl][1]));
        return;
    }
}

int main(){
    Sakii::main();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int near_safe(vector<int> safe, int x) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (it == sz(safe)) return safe[it - 1];
    if (it == 0) return safe[it];
    return (safe[it] - x >= x - safe[it - 1] ? safe[it - 1] : safe[it]);
}

int main() {
    int n, m, k, q;
    cin >> n >> m >> k >> q;

    int l[n], r[n];
    fill_n(l, n, inf);
    fill_n(r, n, -inf);

    rep(i, k) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        chmin(l[x], y);
        chmax(r[x], y);
    }

    vector<int> safe(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }
    // cout << n << '\n';

    rep(i, n - 1) {
        // 先に左回収した場合
        int L = abs(nc - r[i]) + abs(r[i] - l[i]);
        int tmp = near_safe(safe, l[i]);
        // cout << L << " " << tmp << '\n';
        L += abs(l[i] - tmp) + 1 + (l[i + 1] != inf ? abs(l[i + 1] - tmp) : 0);

        int R = abs(nc - l[i]) + abs(r[i] - l[i]);
        tmp = near_safe(safe, r[i]);
        R += abs(r[i] - tmp) + 1 + (r[i + 1] != -inf ? abs(r[i + 1] - tmp) : 0);

        if (L < R) {
            sum += L;
            nc = (l[i + 1] != inf ? abs(l[i + 1] - tmp) : nc);
        } else {
            sum += R;
            nc = (r[i + 1] != -inf ? abs(r[i + 1] - tmp) : nc);
        }

        // cout << nc << " " << L << " " << R << '\n';
    }

    if (nc - l[n - 1] <= r[n - 1] - nc) {
        sum += abs(nc - l[n - 1]);
        nc = l[n - 1];
        sum += abs(r[n - 1] - nc);
    } else {
        sum += abs(r[n - 1] - nc);
        nc = r[n - 1];
        sum += abs(nc - l[n - 1]);
    }

    cout << sum << '\n';
}

/*
// 横移動 and 上
if (r[i + 1] <= nc) {
    if (l[i] != r[i]) {
        sum += abs(r[i] - nc);
        nc = r[i];
        sum += abs(r[i] - nc);
        nc = l[i];
    } else {
        sum += abs(nc - l[i]);
        nc = l[i];
    }

    int it = (int)(upper_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it != 0)]);
    nc = safe[it - (it != 0)];
} else { // r[i + 1] > nc
    if (l[i] != r[i]) {
        sum += abs(l[i] - nc);
        nc = l[i];
        sum += abs(r[i] - nc);
        nc = r[i];
    } else {
        sum += abs(nc - r[i]);
        nc = r[i];
    }

    int it = (int)(lower_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it == sz(safe))]);
    nc = safe[it - (it == sz(safe))];
}
sum++;
cout << "nc " << nc << " " << sum << '\n';
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
// #define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

const int inf = 1e6 + 7;
vector<int> safe;
int near_safe(int x, int key) {
    if (key == 0) { // it
        int it = (int)(lower_bound(all(safe), x) - safe.begin());
        return (it < sz(safe) ? safe[it] : inf);
    } else { // it - 1
        int it = (int)(upper_bound(all(safe), x) - safe.begin() - 1);
        return (it >= 0 ? safe[it] : inf);
    }
}

pii calc_divided_case(int L, int nc, int l, int l2, int tmp) {
    // now at l
    nc = tmp; // go to safe

    L += abs(l - tmp) + abs(l2 - tmp);
    nc = l2;

    return pii(L, nc);
}

pii calc_i_to_i2_dist_and_pos(int nc, int l, int r, int l2, int r2) {
    // cout << l << " " << r << " " << l2 << " " << r2 << '\n';
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    // cout << "L " << L << '\n';
    nc = l;
    int tmp = near_safe(l, 0);
    int tmp2 = near_safe(l, 1);
    // cout << tmp << " " << tmp2 << '\n';
    int L2 = L, nc2 = nc;

    rep(i, 4) {
        pii par = calc_divided_case(L2, nc2, l, (i < 2 ? l2 : r2), (i % 2 ? tmp2 : tmp));
        // cout << "par.F " << par.F << '\n';
        if (i == 0) { L = par.F; nc = par.S; }
        else if (par.F < L) {
            L = par.F;
            nc = par.S;
        }

    }

    return pii(L, nc);
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }
    // cout << n - 1 << '\n';

    chmin(l[0], 0);
    chmax(r[0], 0);

    int i = 0, j = 1;
    int flg = 0;

    while (1) {
        if (l[i] == inf) {
            i++;
            if (i >= n - 1) {
                flg = 1;
                break;
            }
            continue;
        }
        if (flg) break;
        while (l[j] == inf) {
            j++;
            // cout << j << '\n';
            if (j >= n) {
                // cout << "a " << '\n';
                flg = 1;
                break;
            }
            continue;
        }
        if (flg) break;

        // cout << i << " " << j << '\n';
        // 今いる場所から右端に行って左端から上がり, 右端か左端に行く
        pii L = calc_i_to_i2_dist_and_pos(nc, l[i], r[i], l[j], r[j]);
        pii R = calc_i_to_i2_dist_and_pos(nc, r[i], l[i], r[j], l[j]);

        if (L.F < R.F) {
            sum += L.F;
            nc = L.S;
        } else {
            sum += R.F;
            nc = R.S;
        }
        sum += j - i;

        if (i >= n - 1 || j >= n - 1) break; // jがn - 1のturn終えたあとbreak
        i = j;
        j = i + 1;

        // cout << "nc " << nc << " " << "sum " << sum << '\n';
    }
    if (flg) {
        sum += j - i;
    }
    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<int> safe;
int near_safe(int x, int key) {
    if (key == 0) { // it
        int it = (int)(lower_bound(all(safe), x) - safe.begin());
        return (it < sz(safe) ? safe[it] : inf);
    } else { // it - 1
        int it = (int)(upper_bound(all(safe), x) - safe.begin() - 1);
        return (it >= 0 ? safe[it] : inf);
    }
}

pii calc_divided_case(int L, int nc, int l, int l2, int tmp) {
    // now at l
    nc = tmp; // go to safe
    if (l2 == inf) {
        L += abs(l - tmp) + 1;
    } else {
        L += abs(l - tmp) + 1 + abs(l2 - tmp);
        nc = l2;
    }

    return pii(L, nc);
}

pii calc_i_to_i2_dist_and_pos(int nc, int l, int r, int l2, int r2) {
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    // cout << "L " << L << '\n';
    nc = l;
    int tmp = near_safe(l, 0);
    int tmp2 = near_safe(l, 1);

    int L2 = L, nc2 = nc;

    rep(i, 4) {
        pii par = calc_divided_case(L2, nc2, l, (i < 2 ? l2 : r2), (i % 2 ? tmp2 : tmp));
        // cout << "par.F " << par.F << '\n';
        if (i == 0) { L = par.F; nc = par.S; }
        else if (par.F < L) {
            L = par.F;
            nc = par.S;
        }

    }

    return pii(L, nc);
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }

    rep(i, n - 1) {
        // cout << i << '\n';
        if (l[i] == inf) {
            l[i] = r[i] = nc;
        }

        // 今いる場所から右端に行って左端から上がり, 右端か左端に行く
        pii L = calc_i_to_i2_dist_and_pos(nc, l[i], r[i], l[i + 1], r[i + 1]);
        pii R = calc_i_to_i2_dist_and_pos(nc, r[i], l[i], r[i + 1], l[i + 1]);

        if (L.F < R.F) {
            sum += L.F;
            nc = L.S;
        } else {
            sum += R.F;
            nc = R.S;
        }
        // cout << i << " " << j << '\n';

        // cout << nc << " " << sum << '\n';
    }

    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int near_safe(vector<int> safe, int x) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (it == sz(safe)) return safe[it - 1];
    if (it == 0) return safe[it];
    return (safe[it] - x >= x - safe[it - 1] ? safe[it - 1] : safe[it]);
}

int main() {
    int n, m, k, q;
    cin >> n >> m >> k >> q;

    int l[n], r[n];
    fill_n(l, n, inf);
    fill_n(r, n, -inf);

    rep(i, k) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        chmin(l[x], y);
        chmax(r[x], y);
    }

    vector<int> safe(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
            break;
        }
    }
    // cout << n << '\n';

    rep(i, n - 1) {
        // 先に左回収した場合
        int L = abs(nc - r[i]) + abs(r[i] - l[i]);
        int tmp = near_safe(safe, l[i]);
        // cout << L << " " << tmp << '\n';
        L += abs(l[i] - tmp) + 1 + abs(l[i + 1] - tmp);

        int R = abs(nc - l[i]) + abs(r[i] - l[i]);
        tmp = near_safe(safe, r[i]);
        R += abs(r[i] - tmp) + 1 + abs(r[i + 1] - tmp);

        if (L < R) {
            sum += L;
            nc = l[i + 1];
        } else {
            sum += R;
            nc = r[i + 1];
        }

        // cout << nc << " " << L << " " << R << '\n';
    }

    if (nc - l[n - 1] <= r[n - 1] - nc) {
        sum += abs(nc - l[n - 1]);
        nc = l[n - 1];
        sum += abs(r[n - 1] - nc);
    } else {
        sum += abs(r[n - 1] - nc);
        nc = r[n - 1];
        sum += abs(nc - l[n - 1]);
    }

    cout << sum << '\n';
}

/*
// 横移動 and 上
if (r[i + 1] <= nc) {
    if (l[i] != r[i]) {
        sum += abs(r[i] - nc);
        nc = r[i];
        sum += abs(r[i] - nc);
        nc = l[i];
    } else {
        sum += abs(nc - l[i]);
        nc = l[i];
    }

    int it = (int)(upper_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it != 0)]);
    nc = safe[it - (it != 0)];
} else { // r[i + 1] > nc
    if (l[i] != r[i]) {
        sum += abs(l[i] - nc);
        nc = l[i];
        sum += abs(r[i] - nc);
        nc = r[i];
    } else {
        sum += abs(nc - r[i]);
        nc = r[i];
    }

    int it = (int)(lower_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it == sz(safe))]);
    nc = safe[it - (it == sz(safe))];
}
sum++;
cout << "nc " << nc << " " << sum << '\n';
*/


#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define F first
    #define S second
    #define pii pair<int, int>
    #define eb emplace_back
    #define all(v) v.begin(), v.end()
    #define rep(i, n) for (int i = 0; i < (n); ++i)
    #define rep3(i, l, n) for (int i = l; i < (n); ++i)
    #define sz(v) (int)v.size()
    #define inf (int)(1e9+7)
    #define abs(x) (x >= 0 ? x : -(x))
    #define ceil(a, b) a / b + !!(a % b)
    template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
    template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
    ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
    template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

    vector<int> safe;
    const ll INF = 1e18;
    const int mxm = 200005;
    ll dp[mxm][2];
    int a[mxm][2];

    int trans(int i, int v, int j, int u) {
        // cout << i << " " << v << " " << j << " " << u << '\n';
        int ret = inf;
        int it = (int)(lower_bound(all(safe), a[j][u]) - safe.begin());
        if (it < sz(safe)) {
            chmin(ret, abs(safe[it] - a[j][u]) + abs(safe[it] - a[i][v ^ 1]) + abs(a[i][v] - a[i][v ^ 1]));
            // cout << safe[it] << " " << a[j][u] << " " << a[i][v] << " " << a[i][v ^ 1] << '\n';
        }
        it = (int)(upper_bound(all(safe), a[j][u]) - safe.begin() - 1);
        if (it >= 0) {
            chmin(ret, abs(a[j][u] - safe[it]) + abs(safe[it] - a[i][v ^ 1]) + abs(a[i][v] - a[i][v ^ 1]));
        }
        // cout << ret << '\n';
        return ret;
    }

    int main() {
        int n, m, k, q; cin >> n >> m >> k >> q;

        fill_n(*dp, mxm * 2, INF);
        rep(i, n) { a[i][0] = inf; a[i][1] = -inf; }
        rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(a[x][0], y); chmax(a[x][1], y); }

        safe.resize(q);
        rep(i, q) { cin >> safe[i]; safe[i]--; }
        sort(all(safe));

        a[0][0] = 0; // start
        chmax(a[0][1], 0); // if there is no treasure
        dp[0][1] = a[0][1];
        dp[0][0] = a[0][1] + (a[0][1] - a[0][0]);
        // cout << '\n'; rep(i, n) { rep(j, 2) cout << dp[i][j] << " "; cout << '\n'; }

        int j = 0; // nearest row which has treasures
        rep3(i, 1, n) { // go to row i and move laterally
            if (a[i][0] == inf) continue;
            rep(v, 2) rep(u, 2) chmin(dp[i][v], dp[j][u] + trans(i, v, j, u) + i - j);
            j = i;
        }

        // cout << '\n'; rep(i, n) { rep(j, 2) cout << dp[i][j] << " "; cout << '\n'; }

        cout << min(dp[j][0], dp[j][1]) << '\n';

    }


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int near_safe(vector<int> safe, int x) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (it == sz(safe)) return safe[it - 1];
    if (it == 0) return safe[it];
    return (safe[it] - x >= x - safe[it - 1] ? safe[it - 1] : safe[it]);
}

int main() {
    int n, m, k, q;
    cin >> n >> m >> k >> q;

    int l[n], r[n];
    fill_n(l, n, inf);
    fill_n(r, n, -inf);

    rep(i, k) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        chmin(l[x], y);
        chmax(r[x], y);
    }

    vector<int> safe(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }
    // cout << n << '\n';

    rep(i, n - 1) {
        // 先に左回収した場合
        int L = abs(nc - r[i]) + abs(r[i] - l[i]);
        int tmp = near_safe(safe, l[i]);
        cout << L << " " << tmp << '\n';
        L += abs(l[i] - tmp) + 1 + (l[i + 1] != inf ? abs(l[i + 1] - tmp) : 0);

        int R = abs(nc - l[i]) + abs(r[i] - l[i]);
        tmp = near_safe(safe, r[i]);
        R += abs(r[i] - tmp) + 1 + (r[i + 1] != -inf ? abs(r[i + 1] - tmp) : 0);

        if (L < R) {
            sum += L;
            nc = (l[i + 1] != inf ? abs(l[i + 1] - tmp) : nc);
        } else {
            sum += R;
            nc = (r[i + 1] != -inf ? abs(r[i + 1] - tmp) : nc);
        }

        // cout << nc << " " << L << " " << R << '\n';
    }

    if (nc - l[n - 1] <= r[n - 1] - nc) {
        sum += abs(nc - l[n - 1]);
        nc = l[n - 1];
        sum += abs(r[n - 1] - nc);
    } else {
        sum += abs(r[n - 1] - nc);
        nc = r[n - 1];
        sum += abs(nc - l[n - 1]);
    }

    cout << sum << '\n';
}

/*
// 横移動 and 上
if (r[i + 1] <= nc) {
    if (l[i] != r[i]) {
        sum += abs(r[i] - nc);
        nc = r[i];
        sum += abs(r[i] - nc);
        nc = l[i];
    } else {
        sum += abs(nc - l[i]);
        nc = l[i];
    }

    int it = (int)(upper_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it != 0)]);
    nc = safe[it - (it != 0)];
} else { // r[i + 1] > nc
    if (l[i] != r[i]) {
        sum += abs(l[i] - nc);
        nc = l[i];
        sum += abs(r[i] - nc);
        nc = r[i];
    } else {
        sum += abs(nc - r[i]);
        nc = r[i];
    }

    int it = (int)(lower_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it == sz(safe))]);
    nc = safe[it - (it == sz(safe))];
}
sum++;
cout << "nc " << nc << " " << sum << '\n';
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<int> safe;
int near_safe(int x) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (it == sz(safe)) return safe[it - 1];
    if (it == 0) return safe[it];
    return (safe[it] - x >= x - safe[it - 1] ? safe[it - 1] : safe[it]);
}

random_device rnd;
mt19937 mt(rnd());
uniform_int_distribution<> rand100(1, 199999);
#define rm rand100(mt);

int main() {
    // clock_t start, end;
    // start = clock();

    int n, m, k, q;
    cin >> n >> m >> k >> q;
    // n = 2e5, m = 2e5, k = 2e5, q = 2e5;

    int l[n], r[n];
    fill_n(l, n, inf);
    fill_n(r, n, -inf);

    rep(i, k) {
        int x, y;
        cin >> x >> y;
        // x = rm; y = rm;
        x--; y--;
        chmin(l[x], y);
        chmax(r[x], y);
    }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; /* safe[i] = rm; */ safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }
    // cout << n << '\n';

    rep(i, n - 1) {
        l[i] = (l[i] == inf ? nc : l[i]);
        r[i] = (r[i] == -inf ? nc : r[i]);

        int L = abs(nc - r[i]) + abs(r[i] - l[i]);
        int tmp = near_safe(l[i]);

        L += abs(l[i] - tmp) + 1 + (l[i + 1] != inf ? abs(l[i + 1] - tmp) : 0);

        int R = abs(nc - l[i]) + abs(r[i] - l[i]);
        tmp = near_safe(r[i]);
        R += abs(r[i] - tmp) + 1 + (r[i + 1] != -inf ? abs(r[i + 1] - tmp) : 0);

        if (L < R) {
            sum += L;
            nc = l[i];
            nc = (l[i + 1] != inf ? l[i + 1] : nc);
        } else {
            sum += R;
            nc = r[i];
            nc = (r[i + 1] != -inf ? r[i + 1] : nc);
        }

        /*
        if (i % 1000 == 0) {
            end = clock();
            cout << "4 " << (double)(end - start) / CLOCKS_PER_SEC << '\n';
        }
         */
    }

    if (nc - l[n - 1] <= r[n - 1] - nc) {
        sum += abs(nc - l[n - 1]);
        nc = l[n - 1];
        sum += abs(r[n - 1] - nc);
    } else {
        sum += abs(r[n - 1] - nc);
        nc = r[n - 1];
        sum += abs(nc - l[n - 1]);
    }

    cout << sum << '\n';
}

/*
// 横移動 and 上
if (r[i + 1] <= nc) {
    if (l[i] != r[i]) {
        sum += abs(r[i] - nc);
        nc = r[i];
        sum += abs(r[i] - nc);
        nc = l[i];
    } else {
        sum += abs(nc - l[i]);
        nc = l[i];
    }

    int it = (int)(upper_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it != 0)]);
    nc = safe[it - (it != 0)];
} else { // r[i + 1] > nc
    if (l[i] != r[i]) {
        sum += abs(l[i] - nc);
        nc = l[i];
        sum += abs(r[i] - nc);
        nc = r[i];
    } else {
        sum += abs(nc - r[i]);
        nc = r[i];
    }

    int it = (int)(lower_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it == sz(safe))]);
    nc = safe[it - (it == sz(safe))];
}
sum++;
cout << "nc " << nc << " " << sum << '\n';
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
// #define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

const int inf = 1e6 + 7;
vector<int> safe;
int near_safe(int x, int key) {
    if (key == 0) { // it
        int it = (int)(lower_bound(all(safe), x) - safe.begin());
        return (it < sz(safe) ? safe[it] : inf);
    } else { // it - 1
        int it = (int)(upper_bound(all(safe), x) - safe.begin() - 1);
        return (it >= 0 ? safe[it] : inf);
    }
}

pii calc_divided_case(int L, int nc, int l, int l2, int tmp) {
    // now at l
    nc = tmp; // go to safe

    L += abs(l - tmp) + abs(l2 - tmp);
    nc = l2;

    return pii(L, nc);
}

pii calc_i_to_i2_dist_and_pos(int nc, int l, int r, int l2, int r2) {
    // cout << l << " " << r << " " << l2 << " " << r2 << '\n';
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    // cout << "L " << L << '\n';
    nc = l;
    int tmp = near_safe(l, 0);
    int tmp2 = near_safe(l, 1);
    // cout << tmp << " " << tmp2 << '\n';
    int L2 = L, nc2 = nc;

    rep(i, 4) {
        pii par = calc_divided_case(L2, nc2, l, (i < 2 ? l2 : r2), (i % 2 ? tmp2 : tmp));
        // cout << "par.F " << par.F << '\n';
        if (i == 0) { L = par.F; nc = par.S; }
        else if (par.F < L) {
            L = par.F;
            nc = par.S;
        }

    }

    return pii(L, nc);
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }
    // cout << n - 1 << '\n';

    chmin(l[0], 0);
    chmax(r[0], 0);

    int i = 0, j = 1;
    int flg = 0;

    while (1) {
        if (l[i] == inf) {
            i++;
            if (i >= n - 1) {
                flg = 1;
                break;
            }
            continue;
        }
        if (flg) break;
        while (l[j] == inf) {
            j++;
            // cout << j << '\n';
            if (j >= n) {
                // cout << "a " << '\n';
                flg = 1;
                break;
            }
            continue;
        }
        if (flg) break;

        // cout << i << " " << j << '\n';
        // 今いる場所から右端に行って左端から上がり, 右端か左端に行く
        pii L = calc_i_to_i2_dist_and_pos(nc, l[i], r[i], l[j], r[j]);
        pii R = calc_i_to_i2_dist_and_pos(nc, r[i], l[i], r[j], l[j]);

        if (L.F < R.F) {
            sum += L.F;
            nc = L.S;
        } else {
            sum += R.F;
            nc = R.S;
        }
        sum += j - i;

        if (i >= n - 1 || j >= n - 1) break; // jがn - 1のturn終えたあとbreak
        i = j;
        j = i + 1;

        // cout << "nc " << nc << " " << "sum " << sum << '\n';
    }

    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<int> safe;
int near_safe(int x, int key) {
    if (key == 0) { // it
        int it = (int)(lower_bound(all(safe), x) - safe.begin());
        return (it < sz(safe) ? safe[it] : inf);
    } else { // it - 1
        int it = (int)(upper_bound(all(safe), x) - safe.begin() - 1);
        return (it >= 0 ? safe[it] : inf);
    }
}

pii calc_divided_case(int L, int nc, int l, int l2, int tmp) {
    // now at l
    nc = tmp; // go to safe
    L += abs(l - tmp) + 1 + ((l2 != inf && l2 != -inf) ? abs(l2 - tmp) : 0); // up to the most left
    if (l2 != inf && l2 != -inf) nc = l2;
    return pii(L, nc);
}

pii calc_i_to_i2_dist_and_pos(int nc, int l, int r, int l2, int r2) {
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    int tmp = near_safe(l, 0);
    int tmp2 = near_safe(l, 1);

    int L2 = L, nc2 = nc;
    pii par = calc_divided_case(L, nc, l, l2, tmp);
    L = par.F;
    nc = par.S;

    par = calc_divided_case(L2, nc2, l, l2, tmp2);
    if (par.F < L) {
        L = par.F;
        nc = par.S;
    }

    par = calc_divided_case(L2, nc2, l, r2, tmp);
    if (par.F < L) {
        L = par.F;
        nc = par.S;
    }

    par = calc_divided_case(L2, nc2, l, r2, tmp2);
    if (par.F < L) {
        L = par.F;
        nc = par.S;
    }

    return pii(L, nc);
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }

    rep(i, n - 1) {
        if (l[i] == inf) { l[i] = r[i] = nc; }

        // 右端に行って左端から上がる
        pii L = calc_i_to_i2_dist_and_pos(nc, l[i], r[i], l[i + 1], r[i + 1]);
        pii R = calc_i_to_i2_dist_and_pos(nc, r[i], l[i], r[i + 1], l[i + 1]);

        if (L.F < R.F) {
            sum += L.F;
            nc = L.S;
        } else {
            sum += R.F;
            nc = R.S;
        }
    }

    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<int> safe;
int near_safe(int x, int key) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (key == 0) { // it
        return (it == sz(safe) ? inf : safe[it]);
    } else { // it - 1
        return (it == 0 ? inf : safe[it - 1]);
    }
}

pii nxt(int nc, int l, int r, int l2, int r2) {
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    int L2 = L, L3 = L, L4 = L;
    int nc2 = nc, nc3 = nc, nc4 = nc;

    int tmp = near_safe(l, 0);
    int tmp2 = near_safe(l, 1);

    nc = tmp;
    L += abs(l - tmp) + 1 + ((l2 != inf && l2 != -inf) ? abs(l2 - tmp) : 0); // up to the most left
    if (l2 != inf && l2 != -inf) nc = l2;

    nc2 = tmp2;
    L2 += abs(l - tmp) + 1 + ((l2 != inf && l2 != -inf) ? abs(l2 - tmp) : 0); // up to the most left
    if (l2 != inf && l2 != -inf) nc2 = l2;
    if (L > L2) {
        L = L2;
        nc = nc2;
    }

    nc3 = tmp;
    L3 += abs(l - tmp) + 1 + ((r2 != inf && r2 != -inf) ? abs(r2 - tmp) : 0); // up to the most left
    if (r2 != inf && r2 != -inf) nc3 = r2;
    if (L > L3) {
        L = L3;
        nc = nc3;
    }

    nc4 = tmp2;
    L4 += abs(l - tmp) + 1 + ((r2 != inf && r2 != -inf) ? abs(r2 - tmp) : 0); // up to the most left
    if (r2 != inf && r2 != -inf) nc4 = r2;
    if (L > L4) {
        L = L4;
        nc = nc4;
    }

    return pii(L, nc);
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }

    rep(i, n - 1) {
        l[i] = (l[i] == inf ? nc : l[i]);
        r[i] = (r[i] == -inf ? nc : r[i]);

        pii L = nxt(nc, l[i], r[i], l[i + 1], r[i + 1]);
        pii R = nxt(nc, r[i], l[i], r[i + 1], r[i + 1]);

        if (L.F < R.F) {
            sum += L.F;
            nc = L.S;
        } else {
            sum += R.F;
            nc = R.S;
        }
    }

    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int near_safe(vector<int> safe, int x) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (it == sz(safe)) return safe[it - 1];
    if (it == 0) return safe[it];
    return (safe[it] - x >= x - safe[it - 1] ? safe[it - 1] : safe[it]);
}

int main() {
    int n, m, k, q;
    cin >> n >> m >> k >> q;

    int l[n], r[n];
    fill_n(l, n, inf);
    fill_n(r, n, -inf);

    rep(i, k) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        chmin(l[x], y);
        chmax(r[x], y);
    }

    vector<int> safe(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }
    // cout << n << '\n';

    rep(i, n - 1) {
        // 先に左回収した場合
        int L = abs(nc - r[i]) + abs(r[i] - l[i]);
        int tmp = near_safe(safe, l[i]);
        // cout << L << " " << tmp << '\n';
        L += abs(l[i] - tmp) + 1 + (l[i + 1] != inf ? abs(l[i + 1] - tmp) : 0);

        int R = abs(nc - l[i]) + abs(r[i] - l[i]);
        tmp = near_safe(safe, r[i]);
        R += abs(r[i] - tmp) + 1 + (r[i + 1] != -inf ? abs(r[i + 1] - tmp) : 0);

        if (L < R) {
            sum += L;
            nc = (l[i + 1] != inf ? l[i + 1] : nc);
        } else {
            sum += R;
            nc = (r[i + 1] != -inf ? r[i + 1] : nc);
        }

        // cout << nc << " " << L << " " << R << '\n';
    }

    if (nc - l[n - 1] <= r[n - 1] - nc) {
        sum += abs(nc - l[n - 1]);
        nc = l[n - 1];
        sum += abs(r[n - 1] - nc);
    } else {
        sum += abs(r[n - 1] - nc);
        nc = r[n - 1];
        sum += abs(nc - l[n - 1]);
    }

    cout << sum << '\n';
}

/*
// 横移動 and 上
if (r[i + 1] <= nc) {
    if (l[i] != r[i]) {
        sum += abs(r[i] - nc);
        nc = r[i];
        sum += abs(r[i] - nc);
        nc = l[i];
    } else {
        sum += abs(nc - l[i]);
        nc = l[i];
    }

    int it = (int)(upper_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it != 0)]);
    nc = safe[it - (it != 0)];
} else { // r[i + 1] > nc
    if (l[i] != r[i]) {
        sum += abs(l[i] - nc);
        nc = l[i];
        sum += abs(r[i] - nc);
        nc = r[i];
    } else {
        sum += abs(nc - r[i]);
        nc = r[i];
    }

    int it = (int)(lower_bound(all(safe), nc) - safe.begin());
    sum += abs(nc - safe[it - (it == sz(safe))]);
    nc = safe[it - (it == sz(safe))];
}
sum++;
cout << "nc " << nc << " " << sum << '\n';
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<int> safe;
int near_safe(int x, int key) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (it == sz(safe)) return safe[it - 1];
    if (it == 0) return safe[it];
    return (safe[it] - x >= x - safe[it - 1] ? safe[it - 1] : safe[it]);
}

int nxt(int& nc, int l, int r, int l2) {
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    int tmp = min(near_safe(l, 0), near_safe(l, 1)); // nearest safe
    nc = tmp;
    L += abs(l - tmp) + 1 + ((l2 != inf && l2 != -inf) ? abs(l2 - tmp) : 0); // up to the most left
    if (l2 != inf && l2 != -inf) nc = l2;
    return L;
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }

    rep(i, n - 1) {
        l[i] = (l[i] == inf ? nc : l[i]);
        r[i] = (r[i] == -inf ? nc : r[i]);

        int tmp = nc;
        int L = nxt(nc, l[i], r[i], l[i + 1]);
        int R = nxt(tmp, r[i], l[i], r[i + 1]);

        if (L < R) sum += L;
        else sum += R;
    }

    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<int> safe;
int near_safe(int x, int key) {
    int it = (int)(lower_bound(all(safe), x) - safe.begin());
    if (key == 0) { // it
        return (it == sz(safe) ? inf : safe[it]);
    } else { // it - 1
        return (it == 0 ? inf : safe[it - 1]);
    }
}

pii partial(int L, int nc, int l, int l2, int tmp) {
    // cout << L << " " << nc << " " << l << " " << l2 << " " << tmp << '\n';
    nc = tmp;
    L += abs(l - tmp) + 1 + ((l2 != inf && l2 != -inf) ? abs(l2 - tmp) : 0); // up to the most left
    // cout << L << '\n';
    if (l2 != inf && l2 != -inf) nc = l2;
    return pii(L, nc);
}
pii nxt(int nc, int l, int r, int l2, int r2) {
    // cout << '\n'; cout << nc << " " << l << " " << r << " " << l2 << " " << r2 << '\n';
    int L = abs(nc - r) + abs(r - l); // go to the most right, and the most left
    // cout << L << '\n';
    int tmp = near_safe(l, 0);
    int tmp2 = near_safe(l, 1);

    int L2 = L;
    pii par = partial(L, nc, l, l2, tmp);
    L = par.F;
    nc = par.S;

    par = partial(L2, nc, l, l2, tmp2); // L2大事!! Lは上で書き換えられてる
    if (par.F < L) {
        L = par.F;
        nc = par.S;
    }

    par = partial(L2, nc, l, r2, tmp);
    if (par.F < L) {
        L = par.F;
        nc = par.S;
    }

    par = partial(L2, nc, l, r2, tmp2);
    if (par.F < L) {
        L = par.F;
        nc = par.S;
    }

    return pii(L, nc);
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;
    int l[n], r[n]; fill_n(l, n, inf); fill_n(r, n, -inf);
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(l[x], y); chmax(r[x], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    ll sum = 0;
    int nc = 0;

    for (int i = n - 1; i >= 0; --i) {
        if (l[i] == inf) {
            n = i;
        } else break;
    }

    rep(i, n - 1) {
        l[i] = (l[i] == inf ? nc : l[i]);
        r[i] = (r[i] == -inf ? nc : r[i]);

        pii L = nxt(nc, l[i], r[i], l[i + 1], r[i + 1]);
        pii R = nxt(nc, r[i], l[i], r[i + 1], l[i + 1]);

        if (L.F < R.F) {
            sum += L.F;
            nc = L.S;
        } else {
            sum += R.F;
            nc = R.S;
        }
        // cout << nc << " " << sum << '\n';
    }

    sum += min(abs(nc - l[n - 1]), abs(nc - r[n - 1])) + r[n - 1] - l[n - 1];
    cout << sum << '\n';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<ll> safe;
const ll INF = 1e18;
const int mxm = 200005;
ll dp[mxm][2];
ll a[mxm][2];

ll trans(int i, int v, int j, int u) {
    // cout << i << " " << v << " " << j << " " << u << '\n';
    ll ret = INF;
    int it = (int)(lower_bound(all(safe), a[j][u]) - safe.begin());
    if (it < sz(safe)) {
        chmin(ret, abs(safe[it] - a[j][u]) + abs(safe[it] - a[i][v ^ 1]) + abs(a[i][v] - a[i][v ^ 1]));
        // cout << safe[it] << " " << a[j][u] << " " << a[i][v] << " " << a[i][v ^ 1] << '\n';
    }
    it = (int)(upper_bound(all(safe), a[j][u]) - safe.begin() - 1);
    if (it >= 0) {
        chmin(ret, abs(a[j][u] - safe[it]) + abs(safe[it] - a[i][v ^ 1]) + abs(a[i][v] - a[i][v ^ 1]));
    }
    // cout << ret << '\n';
    return ret;
}

int main() {
    int n, m, k, q; cin >> n >> m >> k >> q;

    fill_n(*dp, mxm * 2, INF);
    rep(i, n) { a[i][0] = inf; a[i][1] = -inf; }
    rep(i, k) { int x, y; cin >> x >> y; x--; y--; chmin(a[x][0], y); chmax(a[x][1], y); }

    safe.resize(q);
    rep(i, q) { cin >> safe[i]; safe[i]--; }
    sort(all(safe));

    a[0][0] = 0; // start
    chmax(a[0][1], 0); // if there is no treasure
    dp[0][1] = a[0][1];
    dp[0][0] = a[0][1] + (a[0][1] - a[0][0]);
    // cout << '\n'; rep(i, n) { rep(j, 2) cout << dp[i][j] << " "; cout << '\n'; }

    int j = 0; // nearest row which has treasures
    rep3(i, 1, n) { // go to row i and move laterally
        if (a[i][0] == inf) continue;
        rep(v, 2) rep(u, 2) chmin(dp[i][v], dp[j][u] + trans(i, v, j, u) + i - j);
        j = i;
    }

    // cout << '\n'; rep(i, n) { rep(j, 2) cout << dp[i][j] << " "; cout << '\n'; }

    cout << min(dp[n - 1][0], dp[n - 1][1]) << '\n';

}