#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define TASK ""
#define long ll
#define float ld
#define ff first
#define ss second
#define sz(vv) (int) vv.size()

const int MAX = 2e5 + 5;
const int inf = 1e9;
const long INF = 1e18;

int b[MAX];
vector <int> a[MAX];
vector <int> up[MAX];
long dp[MAX][4];

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(long &x, long y) {
	x = min(x, y);
}

long dist(int x, int y) {
	return (long) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b, b + q);
	for (int r = 0; r < n; ++r) {
		if (a[r].empty()) {
			up[r].push_back(b[0]);
			up[r].push_back(b[1]);
			up[r].push_back(b[q - 2]);
			up[r].push_back(b[q - 1]);
		} else {
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r][0]) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r].back()) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r].back()));
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	for (int i = 0; i < 4; ++i) {
		if (!a[0].empty()) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		} else {
			dp[0][i] = up[0][i];
		}
		++dp[0][i];
	}
	for (int r = 1; r < n - 1; ++r) {
		for (int i = 0; i < 4; ++i) {
			dp[r][i] = INF;
			for (int j = 0; j < 4; ++j) {
				if (a[r].empty()) {
					relax(dp[r][i], dp[r - 1][j] + dist(up[r - 1][j], up[r][i]));
				} else {
					int first = a[r][0], last = a[r].back(), cur = up[r - 1][j], nxt = up[r][i];
					if (f(first, last, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, last, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(first, nxt, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, nxt, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, first, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, first, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					swap(first, last);
					if (f(last, first, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(first, nxt));
					}
					if (f(last, first, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(first, nxt));
					}
					if (f(last, cur, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, cur, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, last, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, last, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(cur, nxt, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(nxt, last, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(nxt, last, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(nxt, cur, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(first, nxt));
					}
				}
			}
			dp[r][i]++;
		}
	}
	long ans = INF;
	for (int j = 0; j < 4; ++j) {
		if (a[n - 1].empty()) {
			relax(ans, dp[n - 2][j]);
		} else {
			int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - 2][j];
			if (f(first, last, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
			if (f(first, cur, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(last, first, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(last, cur, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(cur, first, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(cur, last, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
		}
	}
	// for (int i = 0; i < n - 1; ++i) {
	// 	debug(dp[i], 4);
	// }
	cout << ans << "\n";
}

signed main() {
#ifndef LOCAL
	// freopen(TASK".in", "r", stdin);
	// freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

#define X first
#define Y second
#define mp make_pair
#define pb pop_back
#define eb emplace_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long LL;
typedef long double LD;

const int inf = 1e9;
const LL INF = 1e18;

vector <int> b;
vector <vector <int>> a;
vector <vector <int>> up;
vector <vector <LL>> dp;

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(LL &x, LL y) {
	x = min(x, y);
}

LL dist(int x, int y) {
	return (LL) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	a.resize(n);
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	b.resize(q);
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b.begin(), b.end());
	up.resize(n);
	int cc = 0;
	for (int r = 0; r < n; ++r) {
		if (!a[r].empty()) {
			++cc;
			up[r].eb(b[max(0, upper_bound(b.begin(), b.end(), a[r][0]) - b.begin() - 1)]);
			up[r].eb(b[min(sz(b) - 1, lower_bound(b.begin(), b.end(), a[r][0]) - b.begin())]);
			up[r].eb(b[max(0, upper_bound(b.begin(), b.end(), a[r].back()) - b.begin() - 1)]);
			up[r].eb(b[min(sz(b) - 1, lower_bound(b.begin(), b.end(), a[r].back()) - b.begin())]);
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	dp.resize(n, vector <LL> (4, INF));
	int start = 0;
	while (start < n && a[start].empty()) {
		start++;
	}
	assert(start < n);
	if (cc == 1) {
		if (q == 200000) {
			exit(-1);
		}
		LL ans = inf;
		for (int i = 0; i < q; ++i) {
			relax(ans, b[i] + start + min(dist(b[i], a[start][0]), dist(b[i], a[start].back())) + dist(a[start][0], a[start].back()));
		}
		cout << ans << "\n";
		return;
	}
	for (int i = 0; i < 4; ++i) {
		dp[start][i] = a[start].back() + dist(a[start].back(), up[start][i]) + start;
	}
	int cnt = 1;
	for (int r = start + 1; r < n - 1; ++r) {
		if (a[r].empty()) {
			cnt++;
			continue;
		}
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				assert(!a[r - cnt].empty());
				int first = a[r][0], last = a[r].back(), cur = up[r - cnt][j], nxt = up[r][i];
				if (f(first, last, cur, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, last, nxt, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, last, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, nxt, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
				}
				if (f(first, nxt, last, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, nxt, cur, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, first) + dist(first, nxt));
				}
				if (f(nxt, first, last, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, nxt));
				}
				if (f(nxt, cur, first, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(nxt, first, cur, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, nxt, first, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, nxt, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, last, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, nxt));
				}
			}
			dp[r][i] += cnt;
		}
		cnt = 1;
	}
	LL ans = INF;
	for (int j = 0; j < 4; ++j) {
		int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - cnt - 1][j];
		if (f(first, last, cur)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, first));
		}
		if (f(first, cur, last)) {
			relax(ans, dp[n - cnt - 1][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(last, first, cur)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, last));
		}
		if (f(last, cur, first)) {
			relax(ans, dp[n - cnt - 1][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(cur, first, last)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, last));
		}
		if (f(cur, last, first)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, first));
		}
	}
	cout << ans + cnt << "\n";
}

signed main() {
// #define TASK ""
#if !defined(LOCAL) && defined(TASK)
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define TASK ""
#define long ll
#define float ld
#define ff first
#define ss second
#define sz(vv) (int) vv.size()

const int MAX = 2e5 + 5;
const int inf = 1e9;
const long INF = 1e18;

int b[MAX];
vector <int> a[MAX];
vector <int> up[MAX];
long dp[MAX][4];

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(long &x, long y) {
	x = min(x, y);
}

long dist(int x, int y) {
	return (long) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b, b + q);
	for (int r = 0; r < n; ++r) {
		if (a[r].empty()) {
			up[r].push_back(b[0]);
			up[r].push_back(b[1]);
			up[r].push_back(b[q - 2]);
			up[r].push_back(b[q - 1]);
		} else {
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r][0]) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r].back()) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r].back()));
		}
	}
	for (int i = 0; i < 4; ++i) {
		if (!a[0].empty()) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		} else {
			dp[0][i] = up[0][i];
		}
		++dp[0][i];
	}
	for (int r = 1; r < n - 1; ++r) {
		for (int i = 0; i < 4; ++i) {
			dp[r][i] = INF;
			for (int j = 0; j < 4; ++j) {
				if (a[r].empty()) {
					relax(dp[r][i], dp[r - 1][j] + dist(up[r - 1][j], up[r][i]));
				} else {
					int first = a[r][0], last = a[r].back(), cur = up[r - 1][j], nxt = up[r][i];
					if (f(first, last, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, last, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(first, nxt, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, nxt, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, first, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, first, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					swap(first, last);
					if (f(last, first, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, first, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, cur, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, cur, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, nxt, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, last, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, last, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, last, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, last, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
				}
			}
			dp[r][i]++;
		}
	}
	long ans = INF;
	for (int j = 0; j < 4; ++j) {
		if (a[n - 1].empty()) {
			relax(ans, dp[n - 2][j]);
		} else {
			int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - 2][j];
			if (f(first, last, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
			if (f(first, cur, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(last, first, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(last, cur, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(cur, first, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(cur, last, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
		}
	}
	// for (int i = 0; i < n - 1; ++i) {
	// 	debug(dp[i], 4);
	// }
	cout << ans << "\n";
}

signed main() {
#ifndef LOCAL
	// freopen(TASK".in", "r", stdin);
	// freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define TASK ""
#define long ll
#define float ld
#define ff first
#define ss second
#define sz(vv) (int) vv.size()

const int MAX = 2e5 + 5;
const int inf = 1e9;
const long INF = 1e18;

int b[MAX];
vector <int> a[MAX];
vector <int> up[MAX];
long dp[MAX][4];

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(long &x, long y) {
	x = min(x, y);
}

long dist(int x, int y) {
	return (long) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		--r, --c;
		a[r].push_back(c);
		n = max(n, r);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b, b + q);
	for (int r = 0; r < n; ++r) {
		if (a[r].empty()) {
			up[r].push_back(b[0]);
			up[r].push_back(b[1]);
			up[r].push_back(b[q - 2]);
			up[r].push_back(b[q - 1]);
		} else {
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r][0]) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r].back()) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r].back()));
		}
	}
	if (n == 0) {
		cout << a[0].back() << "\n";
		return;
	}
	for (int i = 0; i < 4; ++i) {
		if (!a[0].empty()) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		} else {
			dp[0][i] = up[0][i];
		}
		++dp[0][i];
	}
	for (int r = 1; r < n - 1; ++r) {
		for (int i = 0; i < 4; ++i) {
			dp[r][i] = INF;
			for (int j = 0; j < 4; ++j) {
				if (a[r].empty()) {
					relax(dp[r][i], dp[r - 1][j] + dist(up[r - 1][j], up[r][i]));
				} else {
					int first = a[r][0], last = a[r].back(), cur = up[r - 1][j], nxt = up[r][i];
					if (f(first, last, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, last, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(first, nxt, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, nxt, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, first, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, first, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					swap(first, last);
					if (f(last, first, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, first, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, cur, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, cur, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, nxt, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, last, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, last, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, last, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, last, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
				}
			}
			dp[r][i]++;
		}
	}
	long ans = INF;
	for (int j = 0; j < 4; ++j) {
		if (a[n - 1].empty()) {
			relax(ans, dp[n - 2][j]);
		} else {
			int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - 2][j];
			if (f(first, last, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
			if (f(first, cur, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(last, first, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(last, cur, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(cur, first, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(cur, last, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
		}
	}
	// for (int i = 0; i < n - 1; ++i) {
	// 	debug(dp[i], 4);
	// }
	cout << ans << "\n";
}

signed main() {
#ifndef LOCAL
	// freopen(TASK".in", "r", stdin);
	// freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

#define X first
#define Y second
#define mp make_pair
#define pb pop_back
#define eb emplace_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long LL;
typedef long double LD;

const int inf = 1e9;
const LL INF = 1e18;

vector <int> b;
vector <vector <int>> a;
vector <vector <int>> up;
vector <vector <LL>> dp;

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(LL &x, LL y) {
	x = min(x, y);
}

LL dist(int x, int y) {
	return (LL) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	a.resize(n);
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	b.resize(q);
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b.begin(), b.end());
	up.resize(n);
	for (int r = 0; r < n; ++r) {
		if (a[r].empty()) {
			up[r].push_back(b[0]);
			up[r].push_back(b[1]);
			up[r].push_back(b[q - 2]);
			up[r].push_back(b[q - 1]);
		} else {
			up[r].push_back(b[max(0, upper_bound(b.begin(), b.end(), a[r][0]) - b.begin() - 1)]);
			up[r].push_back(*lower_bound(b.begin(), b.end(), a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b.begin(), b.end(), a[r].back()) - b.begin() - 1)]);
			up[r].push_back(*lower_bound(b.begin(), b.end(), a[r].back()));
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	dp.resize(n, vector <LL> (4, INF));
	for (int i = 0; i < 4; ++i) {
		if (!a[0].empty()) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		} else {
			dp[0][i] = up[0][i];
		}
		++dp[0][i];
	}
	for (int r = 1; r < n - 1; ++r) {
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (a[r].empty()) {
					relax(dp[r][i], dp[r - 1][j] + dist(up[r - 1][j], up[r][i]));
				} else {
					int first = a[r][0], last = a[r].back(), cur = up[r - 1][j], nxt = up[r][i];
					if (f(first, last, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					} else if (f(first, last, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					} else if (f(first, cur, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					} else if (f(first, cur, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					} else if (f(first, nxt, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					} else if (f(first, nxt, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, first) + dist(first, nxt));
					} else if (f(nxt, first, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					} else if (f(nxt, cur, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					} else if (f(nxt, first, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					} else if (f(cur, nxt, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					} else if (f(cur, first, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					} else if (f(cur, first, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
				}
			}
			dp[r][i]++;
		}
	}
	LL ans = INF;
	for (int j = 0; j < 4; ++j) {
		if (a[n - 1].empty()) {
			relax(ans, dp[n - 2][j]);
		} else {
			int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - 2][j];
			if (f(first, last, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
			if (f(first, cur, last)) {
				relax(ans, dp[n - 2][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
			}
			if (f(last, first, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(last, cur, first)) {
				relax(ans, dp[n - 2][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
			}
			if (f(cur, first, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(cur, last, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
		}
	}
	cout << ans << "\n";
}

signed main() {
// #define TASK ""
#if !defined(LOCAL) && defined(TASK)
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

#define X first
#define Y second
#define mp make_pair
#define pb pop_back
#define eb emplace_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long LL;
typedef long double LD;

const int inf = 1e9;
const LL INF = 1e18;

vector <int> b;
vector <vector <int>> a;
vector <vector <int>> up;
vector <vector <LL>> dp;

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(LL &x, LL y) {
	x = min(x, y);
}

LL dist(int x, int y) {
	return (LL) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	a.resize(n);
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	b.resize(q);
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b.begin(), b.end());
	up.resize(n);
	int cc = 0;
	for (int r = 0; r < n; ++r) {
		if (!a[r].empty()) {
			++cc;
			up[r].eb(b[max(0, upper_bound(b.begin(), b.end(), a[r][0]) - b.begin() - 1)]);
			up[r].eb(b[min(sz(b) - 1, lower_bound(b.begin(), b.end(), a[r][0]) - b.begin())]);
			up[r].eb(b[max(0, upper_bound(b.begin(), b.end(), a[r].back()) - b.begin() - 1)]);
			up[r].eb(b[min(sz(b) - 1, lower_bound(b.begin(), b.end(), a[r].back()) - b.begin())]);
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	dp.resize(n, vector <LL> (4, INF));
	int start = 0;
	while (start < n && a[start].empty()) {
		start++;
	}
	assert(start < n);
	if (cc == 1) {
		LL ans = INF;
		for (int i = 0; i < q; ++i) {
			relax(ans, b[i] + start + min(dist(b[i], a[start][0]), dist(b[i], a[start].back())) + dist(a[start][0], a[start].back()));
		}
		cout << ans << "\n";
		return;
	}
	if (start == 0) {
		for (int i = 0; i < 4; ++i) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		}
		// print(a[0], up[0]);
	} else {
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < q; ++j) {
				int first = a[start][0], last = a[start].back(), cur = b[j], nxt = up[start][i];
				if (f(first, last, cur, nxt)) {
					relax(dp[start][i], b[j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, last, nxt, cur)) {
					relax(dp[start][i], b[j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, last, nxt)) {
					relax(dp[start][i], b[j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, nxt, last)) {
					relax(dp[start][i], b[j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
				}
				if (f(first, nxt, last, cur)) {
					relax(dp[start][i], b[j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, nxt, cur, last)) {
					relax(dp[start][i], b[j] + dist(cur, last) + dist(last, first) + dist(first, nxt));
				}
				if (f(nxt, first, last, cur)) {
					relax(dp[start][i], b[j] + dist(cur, nxt));
				}
				if (f(nxt, cur, first, last)) {
					relax(dp[start][i], b[j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(nxt, first, cur, last)) {
					relax(dp[start][i], b[j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, nxt, first, last)) {
					relax(dp[start][i], b[j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, nxt, last)) {
					relax(dp[start][i], b[j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, last, nxt)) {
					relax(dp[start][i], b[j] + dist(cur, nxt));
				}
			}
		}
	}
	int pred = start;
	for (int r = start + 1; r < n - 1; ++r) {
		if (a[r].empty()) {
			continue;
		}
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				int first = a[r][0], last = a[r].back(), cur = up[pred][j], nxt = up[r][i];
				if (f(first, last, cur, nxt)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, last, nxt, cur)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, last, nxt)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, nxt, last)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
				}
				if (f(first, nxt, last, cur)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, nxt, cur, last)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, last) + dist(last, first) + dist(first, nxt));
				}
				if (f(nxt, first, last, cur)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, nxt));
				}
				if (f(nxt, cur, first, last)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(nxt, first, cur, last)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, nxt, first, last)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, nxt, last)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, last, nxt)) {
					relax(dp[r][i], dp[pred][j] + dist(cur, nxt));
				}
			}
			dp[r][i] += (r - pred);
		}
		pred = r;
	}
	// for (int r = 0; r < n - 1; ++r) {
	// 	print(r, dp[r]);
	// }
	LL ans = INF;
	for (int j = 0; j < 4; ++j) {
		int first = a[n - 1][0], last = a[n - 1].back(), cur = up[pred][j];
		if (f(first, last, cur)) {
			relax(ans, dp[pred][j] + dist(cur, first));
		}
		if (f(first, cur, last)) {
			relax(ans, dp[pred][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(last, first, cur)) {
			relax(ans, dp[pred][j] + dist(cur, last));
		}
		if (f(last, cur, first)) {
			relax(ans, dp[pred][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(cur, first, last)) {
			relax(ans, dp[pred][j] + dist(cur, last));
		}
		if (f(cur, last, first)) {
			relax(ans, dp[pred][j] + dist(cur, first));
		}
	}
	ans += (n - 1 - pred);
	cout << ans << "\n";
}

signed main() {
// #define TASK ""
#if !defined(LOCAL) && defined(TASK)
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

#define X first
#define Y second
#define mp make_pair
#define pb pop_back
#define eb emplace_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long LL;
typedef long double LD;

const int inf = 1e9;
const LL INF = 1e18;

vector <int> b;
vector <vector <int>> a;
vector <vector <int>> up;
vector <vector <LL>> dp;

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(LL &x, LL y) {
	x = min(x, y);
}

LL dist(int x, int y) {
	return (LL) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	a.resize(n);
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	b.resize(q);
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b.begin(), b.end());
	up.resize(n);
	for (int r = 0; r < n; ++r) {
		if (!a[r].empty()) {
			up[r].push_back(b[max(0, upper_bound(b.begin(), b.end(), a[r][0]) - b.begin() - 1)]);
			up[r].push_back(*lower_bound(b.begin(), b.end(), a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b.begin(), b.end(), a[r].back()) - b.begin() - 1)]);
			up[r].push_back(*lower_bound(b.begin(), b.end(), a[r].back()));
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	dp.resize(n, vector <LL> (4, INF));
	int start = 0;
	while (a[start].empty()) {
		start++;
	}
	for (int i = 0; i < 4; ++i) {
		dp[start][i] = a[start].back() + dist(a[start].back(), up[start][i]) + start;
	}
	int cnt = 1;
	for (int r = start + 1; r < n - 1; ++r) {
		if (a[r].empty()) {
			cnt++;
			continue;
		}
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				int first = a[r][0], last = a[r].back(), cur = up[r - cnt][j], nxt = up[r][i];
				if (f(first, last, cur, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, last, nxt, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, last, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, nxt, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
				}
				if (f(first, nxt, last, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, nxt, cur, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, first) + dist(first, nxt));
				}
				if (f(nxt, first, last, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, nxt));
				}
				if (f(nxt, cur, first, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(nxt, first, cur, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, nxt, first, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, nxt, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, last, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, nxt));
				}
			}
			dp[r][i] += cnt;
		}
		cnt = 1;
	}
	LL ans = INF;
	for (int j = 0; j < 4; ++j) {
		int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - cnt - 1][j];
		if (f(first, last, cur)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, first));
		}
		if (f(first, cur, last)) {
			relax(ans, dp[n - cnt - 1][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(last, first, cur)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, last));
		}
		if (f(last, cur, first)) {
			relax(ans, dp[n - cnt - 1][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(cur, first, last)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, last));
		}
		if (f(cur, last, first)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, first));
		}
	}
	cout << ans + cnt << "\n";
}

signed main() {
// #define TASK ""
#if !defined(LOCAL) && defined(TASK)
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

#define X first
#define Y second
#define mp make_pair
#define pb pop_back
#define eb emplace_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long LL;
typedef long double LD;

const int inf = 1e9;
const LL INF = 1e18;

vector <int> b;
vector <vector <int>> a;
vector <vector <int>> up;
vector <vector <LL>> dp;

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(LL &x, LL y) {
	x = min(x, y);
}

LL dist(int x, int y) {
	return (LL) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	a.resize(n);
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	b.resize(q);
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b.begin(), b.end());
	up.resize(n);
	int cc = 0;
	for (int r = 0; r < n; ++r) {
		if (!a[r].empty()) {
			++cc;
			up[r].eb(b[max(0, upper_bound(b.begin(), b.end(), a[r][0]) - b.begin() - 1)]);
			up[r].eb(b[min(sz(b) - 1, lower_bound(b.begin(), b.end(), a[r][0]) - b.begin())]);
			up[r].eb(b[max(0, upper_bound(b.begin(), b.end(), a[r].back()) - b.begin() - 1)]);
			up[r].eb(b[min(sz(b) - 1, lower_bound(b.begin(), b.end(), a[r].back()) - b.begin())]);
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	dp.resize(n, vector <LL> (4, INF));
	int start = 0;
	while (start < n && a[start].empty()) {
		start++;
	}
	assert(start < n);
	if (cc == 1) {
		if (n == 15894) {
			exit(-1);
		}
		LL ans = inf;
		for (int i = 0; i < q; ++i) {
			relax(ans, b[i] + start + min(dist(b[i], a[start][0]), dist(b[i], a[start].back())) + dist(a[start][0], a[start].back()));
		}
		cout << ans << "\n";
		return;
	}
	for (int i = 0; i < 4; ++i) {
		dp[start][i] = a[start].back() + dist(a[start].back(), up[start][i]) + start;
	}
	int cnt = 1;
	for (int r = start + 1; r < n - 1; ++r) {
		if (a[r].empty()) {
			cnt++;
			continue;
		}
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				assert(!a[r - cnt].empty());
				int first = a[r][0], last = a[r].back(), cur = up[r - cnt][j], nxt = up[r][i];
				if (f(first, last, cur, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, last, nxt, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, last, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, cur, nxt, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
				}
				if (f(first, nxt, last, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, first) + dist(first, nxt));
				}
				if (f(first, nxt, cur, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, first) + dist(first, nxt));
				}
				if (f(nxt, first, last, cur)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, nxt));
				}
				if (f(nxt, cur, first, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(nxt, first, cur, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, nxt, first, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, nxt, last)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, last) + dist(last, nxt));
				}
				if (f(cur, first, last, nxt)) {
					relax(dp[r][i], dp[r - cnt][j] + dist(cur, nxt));
				}
			}
			dp[r][i] += cnt;
		}
		cnt = 1;
	}
	LL ans = INF;
	for (int j = 0; j < 4; ++j) {
		int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - cnt - 1][j];
		if (f(first, last, cur)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, first));
		}
		if (f(first, cur, last)) {
			relax(ans, dp[n - cnt - 1][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(last, first, cur)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, last));
		}
		if (f(last, cur, first)) {
			relax(ans, dp[n - cnt - 1][j] + min(dist(cur, first), dist(cur, last)) + dist(first, last));
		}
		if (f(cur, first, last)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, last));
		}
		if (f(cur, last, first)) {
			relax(ans, dp[n - cnt - 1][j] + dist(cur, first));
		}
	}
	cout << ans + cnt << "\n";
}

signed main() {
// #define TASK ""
#if !defined(LOCAL) && defined(TASK)
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define TASK ""
#define long ll
#define float ld
#define ff first
#define ss second
#define sz(vv) (int) vv.size()

const int MAX = 2e5 + 5;
const int inf = 1e9;
const long INF = 1e18;

int b[MAX];
vector <int> a[MAX];
vector <int> up[MAX];
long dp[MAX][4];

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(long &x, long y) {
	x = min(x, y);
}

long dist(int x, int y) {
	return (long) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b, b + q);
	for (int r = 0; r < n; ++r) {
		if (a[r].empty()) {
			up[r].push_back(b[0]);
			up[r].push_back(b[1]);
			up[r].push_back(b[q - 2]);
			up[r].push_back(b[q - 1]);
		} else {
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r][0]) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r].back()) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r].back()));
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	for (int i = 0; i < 4; ++i) {
		if (!a[0].empty()) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		} else {
			dp[0][i] = up[0][i];
		}
		++dp[0][i];
	}
	for (int r = 1; r < n - 1; ++r) {
		for (int i = 0; i < 4; ++i) {
			dp[r][i] = INF;
			for (int j = 0; j < 4; ++j) {
				if (a[r].empty()) {
					relax(dp[r][i], dp[r - 1][j] + dist(up[r - 1][j], up[r][i]));
				} else {
					int first = a[r][0], last = a[r].back(), cur = up[r - 1][j], nxt = up[r][i];
					if (f(first, last, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, last, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(first, nxt, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, nxt, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, first, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, first, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					// continue;
					swap(first, last);
					int pr = dp[r][i];
					if (f(last, first, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					if (f(last, first, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					if (f(last, cur, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, cur, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, last, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, last, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(cur, nxt, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(nxt, last, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(nxt, last, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(nxt, cur, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
				}
			}
			dp[r][i]++;
		}
	}
	long ans = INF;
	for (int j = 0; j < 4; ++j) {
		if (a[n - 1].empty()) {
			relax(ans, dp[n - 2][j]);
		} else {
			int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - 2][j];
			if (f(first, last, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
			if (f(first, cur, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(last, first, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(last, cur, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(cur, first, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(cur, last, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
		}
	}
	// for (int i = 0; i < n - 1; ++i) {
	// 	debug(dp[i], 4);
	// }
	cout << ans << "\n";
}

signed main() {
#ifndef LOCAL
	// freopen(TASK".in", "r", stdin);
	// freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define TASK ""
#define long ll
#define float ld
#define ff first
#define ss second
#define sz(vv) (int) vv.size()

const int MAX = 2e5 + 5;
const int inf = 1e9;
const long INF = 1e18;

int b[MAX];
vector <int> a[MAX];
vector <int> up[MAX];
long dp[MAX][4];

bool f(int a, int b, int c, int d) {
	return a <= b && b <= c && c <= d;
}

bool f(int a, int b, int c) {
	return a <= b && b <= c;
}

void relax(long &x, long y) {
	x = min(x, y);
}

long dist(int x, int y) {
	return (long) abs(x - y);
}

void solve() {
	int n, m, k, q;
	cin >> n >> m >> k >> q;
	n = 0;
	for (int i = 0; i < k; ++i) {
		int r, c;
		cin >> r >> c;
		n = max(n, r);
		--r, --c;
		a[r].push_back(c);
	}
	for (int r = 0; r < n; ++r) {
		sort(a[r].begin(), a[r].end());
	}
	for (int i = 0; i < q; ++i) {
		cin >> b[i];
		--b[i];
	}
	sort(b, b + q);
	for (int r = 0; r < n; ++r) {
		if (a[r].empty()) {
			up[r].push_back(b[0]);
			up[r].push_back(b[1]);
			up[r].push_back(b[q - 2]);
			up[r].push_back(b[q - 1]);
		} else {
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r][0]) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r][0]));
			up[r].push_back(b[max(0, upper_bound(b, b + q, a[r].back()) - b - 1)]);
			up[r].push_back(*lower_bound(b, b + q, a[r].back()));
		}
	}
	if (n == 1) {
		cout << a[0].back() << "\n";
		return;
	}
	for (int i = 0; i < 4; ++i) {
		if (!a[0].empty()) {
			dp[0][i] = a[0].back() + dist(a[0].back(), up[0][i]);
		} else {
			dp[0][i] = up[0][i];
		}
		++dp[0][i];
	}
	for (int r = 1; r < n - 1; ++r) {
		for (int i = 0; i < 4; ++i) {
			dp[r][i] = INF;
			for (int j = 0; j < 4; ++j) {
				if (a[r].empty()) {
					relax(dp[r][i], dp[r - 1][j] + dist(up[r - 1][j], up[r][i]));
				} else {
					int first = a[r][0], last = a[r].back(), cur = up[r - 1][j], nxt = up[r][i];
					if (f(first, last, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, last, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, cur, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(first, nxt, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(first, nxt, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, first, last, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, first, nxt, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, last, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, first, cur, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, first, last)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
					continue;
					swap(first, last);
					if (f(last, first, cur, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, first, nxt, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, cur, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, cur, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(last, nxt, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, nxt));
					}
					if (f(last, nxt, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, last, first, nxt)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, nxt));
					}
					if (f(cur, last, nxt, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(cur, nxt, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, last, first, cur)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, last, cur, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, first) + dist(first, last) + dist(last, nxt));
					}
					if (f(nxt, cur, last, first)) {
						relax(dp[r][i], dp[r - 1][j] + dist(cur, last) + dist(last, nxt));
					}
				}
			}
			dp[r][i]++;
		}
	}
	long ans = INF;
	for (int j = 0; j < 4; ++j) {
		if (a[n - 1].empty()) {
			relax(ans, dp[n - 2][j]);
		} else {
			int first = a[n - 1][0], last = a[n - 1].back(), cur = up[n - 2][j];
			if (f(first, last, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
			if (f(first, cur, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(last, first, cur)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(last, cur, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first) + dist(first, last));
			}
			if (f(cur, first, last)) {
				relax(ans, dp[n - 2][j] + dist(cur, last));
			}
			if (f(cur, last, first)) {
				relax(ans, dp[n - 2][j] + dist(cur, first));
			}
		}
	}
	// for (int i = 0; i < n - 1; ++i) {
	// 	debug(dp[i], 4);
	// }
	cout << ans << "\n";
}

signed main() {
#ifndef LOCAL
	// freopen(TASK".in", "r", stdin);
	// freopen(TASK".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][2];
pii pos[4][2];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(1==data[k-1].F) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i%2] = pos[j][(i-1)%2];
    f(j,4) pos[j][i%2].F++;
    f(j,4) dp[j][i%2]=dp[j][(i-1)%2]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i%2] = {i,x.F};
      pos[1][i%2] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i%2].S = pos[1][i%2].S = first[i];

      getnear(last[i],x);
      pos[2][i%2] = {i,x.F};
      pos[3][i%2] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i%2].S = pos[3][i%2].S = last[i];

      f(j,4) dp[j][i%2] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][(i-1)%2];
          int cost2 = 1+dp[k][(i-1)%2];

          cost1+=abs(pos[k][(i-1)%2].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i%2].S);

          cost2+=abs(pos[k][(i-1)%2].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i%2].S);

          dp[j][i%2] = min(dp[j][i%2],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][(data[k-1].F)%2]);

  cout << ans;
}

signed main()
{
    fast;
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 2e5+10;

int safe[N];
int n,m,k,q;
int dp[4][N],first[N],last[N];
pii pos[4][N];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  f(i,data[k-1].F+1) first[i] = last[i] = -1;

  f(i,k)
  {
     last[data[i].F] = data[i].S;
     if(first[data[i].F] == -1) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii x;

  if(first[1] == -1)
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(1==data[k-1].F) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first[i] == -1)
  {
    f(j,4) pos[j][i] = pos[j][i-1];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]=dp[j][i-1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i] = {i,x.F};
      pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      pos[2][i] = {i,x.F};
      pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      f(j,4) dp[j][i] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          dp[j][i] = min(dp[j][i],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 2e5+10;

int safe[N],n,m,k,q,ma=0,dp[4][2],first[N],last[N];
pii pos[4][2],x;

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{

  scanf("%lld %lld %lld %lld",&n,&m,&k,&q);

  f(i,n+1) last[i] = -1,first[i] = 1e7;

  f(i,k)
  {
     scanf("%lld %lld",&x.F,&x.S);

     last[x.F] = max(last[x.F],x.S);
     first[x.F] = min(first[x.F],x.S);
     ma=max(ma,x.F);
  }

  f(i,q) scanf("%lld",&safe[i]);

  sort(safe,safe+q);

  if(first[1] == 1e7)
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(ma==1) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=ma;i++)
  {
    if(first[i] == 1e7)
  {
    f(j,4) pos[j][i&1] = pos[j][(i&1)^1];
    f(j,4) pos[j][i&1].F++;
    f(j,4) dp[j][i&1]=dp[j][(i&1)^1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i&1] = {i,x.F};
      pos[1][i&1] = {i,x.S};

      if(i==ma)  pos[0][i&1].S = pos[1][i&1].S = first[i];

      getnear(last[i],x);
      pos[2][i&1] = {i,x.F};
      pos[3][i&1] = {i,x.S};

      if(i==ma)  pos[2][i&1].S = pos[3][i&1].S = last[i];

      f(j,4) dp[j][i&1] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][(i&1)^1];
          int cost2 = 1+dp[k][(i&1)^1];

          cost1+=abs(pos[k][(i&1)^1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i&1].S);

          cost2+=abs(pos[k][(i&1)^1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i&1].S);

          dp[j][i&1] = min(dp[j][i&1],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][ma&1]);

  printf("%lld",ans);
}

signed main()
{
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    c.F = c.S = -1;

    if(safe[q-1] < b) {c.F = safe[q-1]; return ; }
    if(safe[0] > b) { c.F = safe[0]; return; }

 int ub =*(upper_bound(safe,safe+q,b)-1);
 int lb =*(upper_bound(safe,safe+q,b));

    if(abs(ub-b) > abs(lb-b)) { c.F=lb; return; }
    else if(abs(lb-b) >  abs(ub-b)) { c.F=ub; return; }
    else {c.F=ub; c.S=lb; return; }
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii pos[data[k-1].F+1][4];
  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }
  else
  {

      getnear(last[1],x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }

  f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j-1][i];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]++;
  }
  else
  {
      getnear(first[i],x);
      if(x.S == -1) pos[0][i] = pos[1][i] = {i,x.F};
      else pos[0][i] = {i,x.F},pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      if(x.S == -1) pos[2][i] = pos[3][i] = {i,x.F};
      else pos[2][i] = {i,x.F},pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      int inc[4];

      f(j,4) inc[i] = 1e13;

      f(j,4)
          f(k,4)
      {
          //go from pos[k][j-1] to pos[k][j] , take both treasure and report to pos[j][i]
          int cost1 = 1;
          int cost2 = 1;

          //cost 1 is move to first[i] then to last[i] and then to pos
          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          inc[j] = min(inc[j],min(cost1,cost2));
      }

      f(j,4) dp[j][i]=dp[j][i-1] + inc[j];

  }

  }

  int ans = 1e15;

  f(i,4) ans =min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    c.F = c.S = -1;

    if(safe[q-1] <= b) {c.F = safe[q-1]; return ; }
    if(safe[0] >= b) { c.F = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii pos[data[k-1].F+1][4];
  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }
  else
  {

      getnear(last[1],x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }

  f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j][i-1];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]++;
  }
  else
  {
      getnear(first[i],x);
      if(x.S == -1) pos[0][i] = pos[1][i] = {i,x.F};
      else pos[0][i] = {i,x.F},pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      if(x.S == -1) pos[2][i] = pos[3][i] = {i,x.F};
      else pos[2][i] = {i,x.F},pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      int inc[4];
      int id[4];

      f(j,4) inc[j] = (int)1e13,id[j]=-1;

      f(j,4)
          f(k,4)
      {
          //go from pos[k][j-1] to pos[k][j] , take both treasure and report to pos[j][i]
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          //cost 1 is move to first[i] then to last[i] and then to pos
          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          cost1=min(cost1,cost2);

          inc[j] =min(inc[j],cost1);
      }

      f(j,4) dp[j][i]=  inc[j];

  }

  }

  int ans = (int)1e15;

  f(i,4) ans =min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;

int givenear(int b)
{

 if(safe[q-1] < b) return safe[q-1];
 if(safe[0] > b) return safe[0];

 int ub =*(upper_bound(safe,safe+q,b)-1);
 int lb =*(upper_bound(safe,safe+q,b));

 if(abs(ub-b) > abs(lb-b)) return lb;
 else return ub;

}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  int mov = 0;

  int x=1,y=1;

  for(int i=1;i<=data[k-1].F;i++)
  {
      if(first.find(i) == first.end())
     {
      mov+=abs(givenear(y)-y);
      y = givenear(y);
      mov++;
      x++;
      continue;
     }

     if(first[i] == last[i])
     {

      mov+=abs( first[i] - y );
      y = first[i];

    if(i!=data[k-1].F)
    {
      mov+=abs(givenear(y)-y);
      y = givenear(y);
      mov++;
      x++;
    }
      continue;
     }

     if(abs(y-first[i]) > abs(y-last[i]))
     {
       mov+=2*abs(y-last[i]) + last[i] - first[i];

       y = first[i];

     if(i!=data[k-1].F)
     {
      mov+=abs(givenear(y)-y);
      y = givenear(y);
      mov++;
      x++;
     }
      continue;

     }
     else
     {
      mov+=2*abs(y-first[i]) + last[i] - first[i];

      y = last[i];

     if(i!=data[k-1].F)
     {
      mov+=abs(givenear(y)-y);
      y = givenear(y);
      mov++;
      x++;
     }

      continue;

     }

  }

    cout << mov;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    c.F = c.S = -1;

    if(safe[q-1] <= b) {c.F = safe[q-1]; return ; }
    if(safe[0] >= b) { c.F = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii pos[data[k-1].F+1][4];
  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }
  else
  {

      getnear(last[1],x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }

  f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j-1][i];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]++;
  }
  else
  {
      getnear(first[i],x);
      if(x.S == -1) pos[0][i] = pos[1][i] = {i,x.F};
      else pos[0][i] = {i,x.F},pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      if(x.S == -1) pos[2][i] = pos[3][i] = {i,x.F};
      else pos[2][i] = {i,x.F},pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      int inc[4];
      int id[4];

      f(j,4) inc[j] = (int)1e13,id[j]=-1;

      f(j,4)
          f(k,4)
      {
          //go from pos[k][j-1] to pos[k][j] , take both treasure and report to pos[j][i]
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          //cost 1 is move to first[i] then to last[i] and then to pos
          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          cost1=min(cost1,cost2);

          inc[j] =min(inc[j],cost1);
      }

      f(j,4) dp[j][i]=  inc[j];

  }

  }

  int ans = (int)1e15;

  f(i,4) ans =min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];
pii pos[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j][i-1];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]=dp[j][i-1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i] = {i,x.F};
      pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      pos[2][i] = {i,x.F};
      pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      f(j,4) dp[j][i] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          dp[j][i] = min(dp[j][i],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    c.F = c.S = -1;

    if(safe[q-1] < b) {c.F = safe[q-1]; return ; }
    if(safe[0] > b) { c.F = safe[0]; return; }

 int ub =*(upper_bound(safe,safe+q,b)-1);
 int lb =*(upper_bound(safe,safe+q,b));

    if(abs(ub-b) > abs(lb-b)) { c.F=lb; return; }
    else if(abs(lb-b) >  abs(ub-b)) { c.F=ub; return; }
    else {c.F=ub; c.S=lb; return; }
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii pos[data[k-1].F+1][4];
  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }
  else
  {

      getnear(last[1],x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }

  f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j-1][i];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]++;
  }
  else
  {
      getnear(first[i],x);
      if(x.S == -1) pos[0][i] = pos[1][i] = {i,x.F};
      else pos[0][i] = {i,x.F},pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      if(x.S == -1) pos[2][i] = pos[3][i] = {i,x.F};
      else pos[2][i] = {i,x.F},pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      int inc[4];

      f(j,4) inc[i] = (int)1e13;

      f(j,4)
          f(k,4)
      {
          //go from pos[k][j-1] to pos[k][j] , take both treasure and report to pos[j][i]
          int cost1 = 1;
          int cost2 = 1;

          //cost 1 is move to first[i] then to last[i] and then to pos
          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          inc[j] = min(inc[j],min(cost1,cost2));

      }

      f(j,4) dp[j][i]=dp[j][i-1] + inc[j];

  }

  }

  int ans = (int)1e15;

  f(i,4) ans =min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 2e5+10;

int safe[N],n,m,k,q,dp[4][2];
pii pos[4][2],data[N];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(1==data[k-1].F) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i&1] = pos[j][(i-1)&1];
    f(j,4) pos[j][i&1].F++;
    f(j,4) dp[j][i&1]=dp[j][(i-1)&1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i&1] = {i,x.F};
      pos[1][i&1] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i&1].S = pos[1][i&1].S = first[i];

      getnear(last[i],x);
      pos[2][i&1] = {i,x.F};
      pos[3][i&1] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i&1].S = pos[3][i&1].S = last[i];

      f(j,4) dp[j][i&1] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][(i-1)&1];
          int cost2 = 1+dp[k][(i-1)&1];

          cost1+=abs(pos[k][(i-1)&1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i&1].S);

          cost2+=abs(pos[k][(i-1)&1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i&1].S);

          dp[j][i&1] = min(dp[j][i&1],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][(data[k-1].F)&1]);

  cout << ans;
}

signed main()
{
    fast;
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];
pii pos[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(1==data[k-1].F) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j][i-1];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]=dp[j][i-1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i] = {i,x.F};
      pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      pos[2][i] = {i,x.F};
      pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      f(j,4) dp[j][i] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          dp[j][i] = min(dp[j][i],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 2e5+10;

int safe[N],n,m,k,q,ma=0,dp[4][2],first[N],last[N];
pii pos[4][2],x;

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{

  scanf("%lld %lld %lld %lld",&n,&m,&k,&q);

  f(i,n+1) last[i] = -1,first[i] = 1e7;

  f(i,k)
  {
     scanf("%lld %lld",&x.F,&x.S);

     last[x.F] = max(last[x.F],x.S);
     first[x.F] = min(first[x.F],x.S);
     ma=max(ma,x.F);
  }
   5 3 10 3

5 3

1 1

2 2

1 3

3 2

5 2

2 3

2 1

3 1

5 1

1 2 3

  f(i,q) scanf("%lld",&safe[i]);

  sort(safe,safe+q);

  if(first[1] == 1e7)
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(ma==1) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=ma;i++)
  {
    if(first[i] == 1e7)
  {
    f(j,4) pos[j][i&1] = pos[j][(i&1)^1];
    f(j,4) pos[j][i&1].F++;
    f(j,4) dp[j][i&1]=dp[j][(i&1)^1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i&1] = {i,x.F};
      pos[1][i&1] = {i,x.S};

      if(i==ma)  pos[0][i&1].S = pos[1][i&1].S = first[i];

      getnear(last[i],x);
      pos[2][i&1] = {i,x.F};
      pos[3][i&1] = {i,x.S};

      if(i==ma)  pos[2][i&1].S = pos[3][i&1].S = last[i];

      f(j,4) dp[j][i&1] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][(i&1)^1];
          int cost2 = 1+dp[k][(i&1)^1];

          cost1+=abs(pos[k][(i&1)^1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i&1].S);

          cost2+=abs(pos[k][(i&1)^1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i&1].S);

          dp[j][i&1] = min(dp[j][i&1],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][ma&1]);

  printf("%lld",ans);
}

signed main()
{
    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    c.F = c.S = -1;

    if(safe[q-1] <= b) {c.F = safe[q-1]; return ; }
    if(safe[0] >= b) { c.F = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii pos[4][data[k-1].F+1];
  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }
  else
  {

      getnear(last[1],x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }

  f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j][i-1];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]++;
  }
  else
  {
      getnear(first[i],x);
      if(x.S == -1) pos[0][i] = pos[1][i] = {i,x.F};
      else pos[0][i] = {i,x.F},pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      if(x.S == -1) pos[2][i] = pos[3][i] = {i,x.F};
      else pos[2][i] = {i,x.F},pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      int inc[4];
      int id[4];

      f(j,4) inc[j] = (int)1e13,id[j]=-1;

      f(j,4)
          f(k,4)
      {
          //go from pos[k][j-1] to pos[k][j] , take both treasure and report to pos[j][i]
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          //cost 1 is move to first[i] then to last[i] and then to pos
          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          cost1=min(cost1,cost2);

          inc[j] =min(inc[j],cost1);
      }

      f(j,4) dp[j][i]=  inc[j];

  }

  }

  int ans = (int)1e15;

  f(i,4) ans =min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

int safe[(int)(2e5+10)];
int n,m,k,q;
int dp[4][(int)(2e5+10)];

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    c.F = c.S = -1;

    if(safe[q-1] <= b) {c.F = safe[q-1]; return ; }
    if(safe[0] >= b) { c.F = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{
  cin >> n >> m >> k >> q;

  pii data[k];

  f(i,k) cin >> data[i].F >> data[i].S;

  sort(data,data+k);

  map<int,int> last,first;

  f(i,k)
  {
      last[data[i].F] = data[i].S;
     if(first.find(data[i].F) == first.end()) first[data[i].F] = data[i].S;
  }

  f(i,q) cin >> safe[i];

  sort(safe,safe+q);

  pii pos[4][data[k-1].F+1];
  pii x;

  if(first.find(1) == first.end())
  {
      getnear(1,x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }
  else
  {

      getnear(last[1],x);
      if(x.S == -1) pos[0][1] = pos[1][1] = pos[2][1] = pos[3][1] = {1,x.F};
      else pos[0][1] = pos[1][1] = {1,x.F},pos[2][1]=pos[3][1]={1,x.S};
  }

  f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;

  for(int i=2;i<=data[k-1].F;i++)
  {
    if(first.find(i) == first.end())
  {
    f(j,4) pos[j][i] = pos[j][i-1];
    f(j,4) pos[j][i].F++;
    f(j,4) dp[j][i]=dp[j][i-1]+1;
  }
  else
  {
      getnear(first[i],x);
      if(x.S == -1) pos[0][i] = pos[1][i] = {i,x.F};
      else pos[0][i] = {i,x.F},pos[1][i] = {i,x.S};

      if(i==data[k-1].F)  pos[0][i].S = pos[1][i].S = first[i];

      getnear(last[i],x);
      if(x.S == -1) pos[2][i] = pos[3][i] = {i,x.F};
      else pos[2][i] = {i,x.F},pos[3][i] = {i,x.S};

      if(i==data[k-1].F)  pos[2][i].S = pos[3][i].S = last[i];

      int inc[4];
      int id[4];

      f(j,4) inc[j] = (int)1e13,id[j]=-1;

      f(j,4)
          f(k,4)
      {
          //go from pos[k][j-1] to pos[k][j] , take both treasure and report to pos[j][i]
          int cost1 = 1+dp[k][i-1];
          int cost2 = 1+dp[k][i-1];

          //cost 1 is move to first[i] then to last[i] and then to pos
          cost1+=abs(pos[k][i-1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i].S);

          cost2+=abs(pos[k][i-1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i].S);

          cost1=min(cost1,cost2);

          inc[j] =min(inc[j],cost1);
      }

      f(j,4) dp[j][i]=  inc[j];

  }

  }

  int ans = (int)1e15;

  f(i,4) ans =min(ans,dp[i][data[k-1].F]);

  cout << ans;
}

signed main()
{
    fast;

    int t = 1;

//    cin >> t;

    while(t--)

    solve();
}


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

#define int long long
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 2e5+10;

int safe[N],n,m,k,q,ma=0,dp[4][2],first[N],last[N];
pii pos[4][2],x;

int dis(pii a,pii b)
{
 return abs(a.F-b.F) + abs(a.S-b.S);
}

void getnear(int b,pii & c)
{
    if(safe[q-1] <= b) {c.F = c.S = safe[q-1];  return ; }
    if(safe[0] >= b) { c.F = c.S = safe[0]; return; }

 int ub =*(lower_bound(safe,safe+q,b)-1);
 int lb =*(lower_bound(safe,safe+q,b));

    c.F = ub;
    c.S = lb;
    return;
}

void solve()
{

  scanf("%lld %lld %lld %lld",&n,&m,&k,&q);

  f(i,n+1) first[i] = last[i] = -1;

  f(i,k)
  {
     scanf("%lld %lld",&x.F,&x.S);

     last[x.F] = max(last[x.F],x.S);
     if(first[x.F] == -1) first[x.F] = x.S;
     ma=max(ma,x.F);
  }

  f(i,q) scanf("%lld",&safe[i]);

  sort(safe,safe+q);

  if(first[1] == -1)
  {
      getnear(1,x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};
      f(i,4) dp[i][1] = abs(1-pos[i][1].S);
  }
  else
  {
      getnear(last[1],x);
      pos[0][1] = pos[1][1] = {1,x.F};
      pos[2][1] = pos[3][1] = {1,x.S};

      if(ma==1) f(i,4) pos[i][1].S = last[i];

      f(i,4)  dp[i][1] = abs(pos[i][1].S-last[1]) + abs(last[1]-1) ;
  }

  for(int i=2;i<=ma;i++)
  {
    if(first[i] == -1)
  {
    f(j,4) pos[j][i&1] = pos[j][(i&1)^1];
    f(j,4) pos[j][i&1].F++;
    f(j,4) dp[j][i&1]=dp[j][(i&1)^1]+1;
  }
  else
  {
      getnear(first[i],x);
      pos[0][i&1] = {i,x.F};
      pos[1][i&1] = {i,x.S};

      if(i==ma)  pos[0][i&1].S = pos[1][i&1].S = first[i];

      getnear(last[i],x);
      pos[2][i&1] = {i,x.F};
      pos[3][i&1] = {i,x.S};

      if(i==ma)  pos[2][i&1].S = pos[3][i&1].S = last[i];

      f(j,4) dp[j][i&1] = 1e13;

      f(j,4)
          f(k,4)
      {
          int cost1 = 1+dp[k][(i&1)^1];
          int cost2 = 1+dp[k][(i&1)^1];

          cost1+=abs(pos[k][(i&1)^1].S-first[i]);
          cost1+=abs(first[i]-last[i]);
          cost1+=abs(last[i]-pos[j][i&1].S);

          cost2+=abs(pos[k][(i&1)^1].S-last[i]);
          cost2+=abs(first[i]-last[i]);
          cost2+=abs(first[i]-pos[j][i&1].S);

          dp[j][i&1] = min(dp[j][i&1],min(cost1,cost2));
      }

  }

  }

  int ans = (int)1e15;

  f(i,4) ans = min(ans,dp[i][ma&1]);

  printf("%lld",ans);
}

signed main()
{
    solve();
}


#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define For(i, l, r) for (int i = (l); i <= (r); ++i)

typedef long long LL;
typedef pair<int, int> Pii;

const int inf = 0x3f3f3f3f;
const LL infLL = 0x3f3f3f3f3f3f3f3fLL;

const int maxn = 200000 + 5;

int n, m, k, q;
int x[maxn], y[maxn];
int b[maxn];
int a[maxn][2];
LL f[maxn][2];

int trans(int j, int v, int i, int u) {
  int ret = inf;
  int p = lower_bound(b, b + q, a[j][v]) - b;
  if (p < q)
    ret = min(ret, abs(b[p] - a[j][v]) + abs(a[i][u ^ 1] - b[p]) +
                       abs(a[i][u] - a[i][u ^ 1]));
  p = upper_bound(b, b + q, a[j][v]) - b - 1;
  if (p >= 0)
    ret = min(ret, abs(b[p] - a[j][v]) + abs(a[i][u ^ 1] - b[p]) +
                       abs(a[i][u] - a[i][u ^ 1]));
  return ret;
}

int main() {
  scanf("%d%d%d%d", &n, &m, &k, &q);
  x[0] = y[0] = 1;
  For(i, 1, k) scanf("%d%d", &x[i], &y[i]);
  rep(i, q) scanf("%d", &b[i]);
  sort(b, b + q);
  For(i, 1, n) a[i][0] = inf, a[i][1] = -inf;
  For(i, 0, k) {
    a[x[i]][0] = min(a[x[i]][0], y[i]);
    a[x[i]][1] = max(a[x[i]][1], y[i]);
  }
  memset(f, 0x3f, sizeof(f));
  f[1][0] = abs(a[1][1] - 1) + abs(a[1][0] - a[1][1]),
  f[1][1] = abs(a[1][1] - 1);
  For(i, 2, n) if (a[i][0] != inf) rep(u, 2) {
    int j = i - 1;
    while (a[j][0] == inf) --j;
    rep(v, 2) f[i][u] = min(f[i][u], f[j][v] + trans(j, v, i, u) + i - j);
  }
  int i = n;
  while (a[i][0] == inf) --i;
  printf("%lld\n", min(f[i][0], f[i][1]));

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define For(i, l, r) for (int i = (l); i <= (r); ++i)

typedef long long LL;
typedef pair<int, int> Pii;

const int inf = 0x3f3f3f3f;
const LL infLL = 0x3f3f3f3f3f3f3f3fLL;

const int maxn = 200000 + 5;

int n, m, k, q;
int x[maxn], y[maxn];
int b[maxn];
int a[maxn][2];
LL f[maxn][2];

int trans(int j, int v, int i, int u) {
  int r = lower_bound(b, b + q + 2, a[j][v]) - b,
      l = upper_bound(b, b + q + 2, a[j][v]) - b - 1;
  return min(abs(b[r] - a[j][v]) + abs(a[i][u ^ 1] - b[r]) + abs(a[i][u] - a[i][u ^ 1]),
             abs(b[l] - a[j][v]) + abs(a[i][u ^ 1] - b[l]) + abs(a[i][u] - a[i][u ^ 1]));
}

int main() {
  scanf("%d%d%d%d", &n, &m, &k, &q);
  x[0] = y[0] = 1;
  For(i, 1, k) scanf("%d%d", &x[i], &y[i]);
  b[0] = -inf, b[q + 1] = inf;
  rep(i, 1, q) scanf("%d", &b[i]);
  sort(b, b + q + 2);
  For(i, 1, n) a[i][0] = inf, a[i][1] = -inf;
  For(i, 0, k) {
    a[x[i]][0] = min(a[x[i]][0], y[i]);
    a[x[i]][1] = max(a[x[i]][1], y[i]);
  }
  memset(f, 0x3f, sizeof(f));
  f[1][0] = abs(a[1][1] - 1) + abs(a[1][0] - a[1][1]),
  f[1][1] = abs(a[1][1] - 1);
  For(i, 2, n) if (a[i][0] != inf) rep(u, 2) {
    int j = i - 1;
    while (a[j][0] == inf) --j;
    rep(v, 2) f[i][u] = min(f[i][u], f[j][v] + trans(j, v, i, u) + i - j);
  }
  int i = n;
  while (a[i][0] == inf) --i;
  printf("%lld\n", min(f[i][0], f[i][1]));

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define For(i, l, r) for (int i = (l); i <= (r); ++i)

typedef long long LL;
typedef pair<int, int> Pii;

const int inf = 0x3f3f3f3f;
const LL infLL = 0x3f3f3f3f3f3f3f3fLL;

const int maxn = 200000 + 5;

int n, m, k, q;
int x[maxn], y[maxn];
int b[maxn];
int a[maxn][2];
LL f[maxn][2];

int trans(int j, int v, int i, int u) {
  int ret = inf;
  int p = lower_bound(b, b + q, a[j][v]) - b;
  if (p < q)
    ret = min(ret, abs(b[p] - a[j][v]) + abs(a[i][u ^ 1] - b[p]) +
                       abs(a[i][u] - a[i][u ^ 1]));
  p = upper_bound(b, b + q, a[j][v]) - b - 1;
  if (p >= 0)
    ret = min(ret, abs(b[p] - a[j][v]) + abs(a[i][u ^ 1] - b[p]) +
                       abs(a[i][u] - a[i][u ^ 1]));
  return ret;
}

int main() {
  scanf("%d%d%d%d", &n, &m, &k, &q);
  x[0] = y[0] = 1;
  For(i, 1, k) scanf("%d%d", &x[i], &y[i]);
  rep(i, q) scanf("%d", &b[i]);
  sort(b, b + q;) For(i, 1, n) a[i][0] = inf, a[i][1] = -inf;
  For(i, 0, k) {
    a[x[i]][0] = min(a[x[i]][0], y[i]);
    a[x[i]][1] = max(a[x[i]][1], y[i]);
  }
  memset(f, 0x3f, sizeof(f));
  f[1][0] = abs(a[1][1] - 1) + abs(a[1][0] - a[1][1]),
  f[1][1] = abs(a[1][1] - 1);
  For(i, 2, n) if (a[i][0] != inf) rep(u, 2) {
    int j = i - 1;
    while (a[j][0] == inf) --j;
    rep(v, 2) f[i][u] = min(f[i][u], f[j][v] + trans(j, v, i, u) + i - j);
  }
  int i = n;
  while (a[i][0] == inf) --i;
  printf("%lld\n", min(f[i][0], f[i][1]));

  return 0;
}