#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   template <class T1, class T2>   struct cmpf {     bool rev;     inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const {       return (a.first < b.first) ^ rev;     }     cmpf(bool b = false) { rev = b; }   };   template <class T1, class T2>   struct cmps {     bool rev;     inline bool operator()(const pair<T1, T2>& a, const pair<T1, T2>& b) const {       return (a.second < b.second) ^ rev;     }     cmps(bool b = false) { rev = b; }   };   long long binpow(long long x, long long p, const long long& mod) {     assert(mod > 0);     long long ret = 1;     for (; p > 0; p >>= 1, x = x * x % mod)       if (p & 1) ret = ret * x % mod;     return ret;   }   template <class T>   bool chmn(T& a, const T& b) {     return (greater<T>()(a, b) ? (a = b, true) : false);   }   template <class T>   bool chmx(T& a, const T& b) {     return (less<T>()(a, b) ? (a = b, true) : false);   }   void setIO(const string& filename =   ) {     if (filename.size() > 0) {       freopen((filename +  .in ).c_str(),  r , stdin);       freopen((filename +  .out ).c_str(),  w , stdout);     }     cin.tie(0)->sync_with_stdio(0);   }   int chr[8] = {-1, 0, 1, 0, -1, -1, 1, 1};   int chc[8] = {0, 1, 0, -1, -1, 1, -1, 1};   const long long MOD = 1e9 + 7;   const int INIT = 1001001001;   const int MN = 201001;   const long long INF = 2e18 + 1;   long long N, M, K, Q;   pair<long long, long long> A[MN];   long long safe[MN];   long long treasure[MN][2];   long long dp[MN][2];   void solve(int testcase) {     cin >> N >> M >> K >> Q;     for (int i = 0; i < N; ++i) {       treasure[i][0] = INIT;       treasure[i][1] = 0;       dp[i][0] = dp[i][1] = INF;     }     vector<long long> rows;     rows.push_back(0);     for (int i = 0; i < K; ++i) {       cin >> A[i].first >> A[i].second;       --A[i].first;       --A[i].second;       rows.push_back(A[i].first);     }     for (int i = 0; i < Q; ++i) {       cin >> safe[i];       --safe[i];     }     sort(safe, safe + Q);     sort(begin(rows), end(rows));     rows.resize(unique(begin(rows), end(rows)) - rows.begin());     const int R = ((int)(rows.size()));     long long up_cost = 0;     for (int i = 0; i < K; ++i) {       chmx(up_cost, A[i].first);       A[i].first = lower_bound(begin(rows), end(rows), A[i].first) - rows.begin();       chmn(treasure[A[i].first][0], A[i].second);       chmx(treasure[A[i].first][1], A[i].second);     }     if (treasure[0][0] == INIT) treasure[0][0] = 0;     dp[0][0] = treasure[0][1] + (treasure[0][1] - treasure[0][0]);     dp[0][1] = treasure[0][1];     for (int r = 1; r < R; ++r) {       long long reach_left = INF, reach_right = INF;       for (int i = 0; i < 4; ++i) {         int idx;         if (i >= 2) {           idx = (upper_bound(safe, safe + Q, treasure[r - 1][i & 1]) - safe) - 1;         } else {           idx = lower_bound(safe, safe + Q, treasure[r - 1][i & 1]) - safe;         }         if (0 <= idx && idx < Q) {           const long long dist =               dp[r - 1][i & 1] + abs(safe[idx] - treasure[r - 1][i & 1]);           chmn(reach_left, dist + abs(treasure[r][0] - safe[idx]));           chmn(reach_right, dist + abs(treasure[r][1] - safe[idx]));         }       }       const long long between = treasure[r][1] - treasure[r][0];       dp[r][0] = reach_right + between;       dp[r][1] = reach_left + between;     }     (treasure, R, 2);     (dp, R, 2);     cout << up_cost + min(dp[R - 1][0], dp[R - 1][1]) << endl;   }   int main() {     setIO();     long long T = 1;     for (int t = 1; t <= T; ++t) {       solve(t);     }     return 0;   }