#include <iostream>
#include <vector>
#include <algorithm>
#include <array>

using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;

void upmin(ull &x, ull y) {
	if (x > y) { x = y; }
}

uint diff(uint x, uint y) {
	if (x <= y) { return y-x; }
	else { return x-y; }
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	uint n, m, k, q;
	cin >> n >> m >> k >> q;
	uint maxr = 0;
	vector<pair<uint,uint>> tr(n, {m, 0});
	while(k--) {
		uint r, c;
		cin >> r >> c;
		r--; c--;
		maxr = max(maxr, r);
		tr[r].first = min(tr[r].first, c);
		tr[r].second = max(tr[r].second, c);
	}
	vector<uint> safe(q);
	for (auto& v : safe) {
		cin >> v;
		v--;
	}
	sort(safe.begin(), safe.end());

	ull ans = maxr + tr[0].second;
	array<uint,2> pos = {tr[0].second, tr[0].second}, pos1;
	array<ull,2> moves = {0, 0}, moves1;
	for (uint i = 1; i < n; i++) {
		if (tr[i].first < m) {
			pos1[0] = tr[i].first; pos1[1] = tr[i].second;
			ans += pos1[1] - pos1[0];
			moves1 = {1ULL<<60, 1ULL<<60};
			for (uint j = 0; j < 2; j++) {
				auto it = lower_bound(safe.begin(), safe.end(), pos[j]);
				if (it != safe.begin()) {
					uint v = *(it-1);
					for (uint k = 0; k < 2; k++) {
						upmin(moves1[k], moves[j] + (pos[j]-v) + diff(v,pos1[k]));
					}
				}
				if (it != safe.end()) {
					uint v = *it;
					for (uint k = 0; k < 2; k++) {
						upmin(moves1[k], moves[j] + (v-pos[j]) + diff(v,pos1[k]));
					}
				}
			}
			swap(pos, pos1);
			swap(moves, moves1);
		}
	}
	cout << ans + min(moves[0], moves[1]) << endl;
	return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x)+abs(a.y-b.y);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
	dp[1][1]=p[r[1]].x-1;
	dp[1][0]+=p[1].y-1;
	dp[1][1]+=p[1].y-1;
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
        ll tmp0=dp[i+1][0],tmp1=dp[i+1][1],d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][0]=tmp1+d;
        dp[i+1][1]=tmp0+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
	dp[1][1]=p[r[1]].x-1;
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
    }
    cout<<min(dp[top][0],dp[top][1])+p[r[top]].x-p[l[top]].x<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x)+abs(a.y-b.y);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    if(p[1].y==1)
    {
    	dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
		dp[1][1]=p[r[1]].x-1;
	}
	else
	{
		dp[1][0]=dis(Node(1,1),p[1]);
		dp[1][1]=dis(Node(1,1),p[r[1]]);
		ll tmp0=dp[1][0],tmp1=dp[1][1],d=abs(p[l[1]].x-p[r[1]].x);
        dp[1][0]=tmp1+d;
        dp[1][1]=tmp0+d;
	}
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
        ll tmp0=dp[i+1][0],tmp1=dp[i+1][1],d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][0]=tmp1+d;
        dp[i+1][1]=tmp0+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
	dp[1][1]=p[r[1]].x-1;
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
    }
    cout<<min(dp[top][0],dp[top][1])+(p[r[top]].x-p[l[top]].x)*(top!=1)<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b,int c){
	return abs(a.y-b.y)+abs(a.x-c)+abs(b.x-c);
}
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=dis(a,b,col[p1]);
    if(p1!=1) ret=min(ret,dis(a,b,col[--p1]));
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    if(p[1].y==1)
    {
    	dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
		dp[1][1]=p[r[1]].x-1;
	}
	else
	{
		ll d=abs(p[l[1]].x-p[r[1]].x);
		dp[1][0]=dis(Node(1,1),p[r[1]])+d;
		dp[1][1]=dis(Node(1,1),p[l[1]])+d;
	}
	rep(i,1,top-1)
    {
        ll d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]))+d;
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]))+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b,int c){
	return abs(a.y-b.y)+abs(a.x-c)+abs(b.x-c);
}
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=min(ret,dis(a,b,col[p1]));
    if(p1!=1) ret=min(ret,dis(a,b,col[--p1]));
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    if(p[1].y==1)
    {
    	dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
		dp[1][1]=p[r[1]].x-1;
	}
	else
	{
		ll d=abs(p[l[1]].x-p[r[1]].x);
		dp[1][0]=dis(Node(1,1),p[r[1]])+d;
		dp[1][1]=dis(Node(1,1),p[l[1]])+d;
	}
	rep(i,1,top-1)
    {
        ll d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]))+d;
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]))+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b,int c){
	return abs(a.y-b.y)+abs(a.x-c)+abs(b.x-c);
}
ll dis (Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=min(ret,dis(a,b,col[p1]));
    if(p1!=1) ret=min(ret,dis(a,b,col[--p1]));
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    if(p[1].y==1)
    {
    	dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
		dp[1][1]=p[r[1]].x-1;
	}
	else
	{
		ll d=abs(p[l[1]].x-p[r[1]].x);
		dp[1][0]=dis(Node(1,1),p[r[1]])+d;
		dp[1][1]=dis(Node(1,1),p[l[1]])+d;
	}
	rep(i,1,top-1)
    {
        ll d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]))+d;
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]))+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x)+abs(a.y-b.y);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
	dp[1][1]=p[r[1]].x-1;
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
        ll tmp0=dp[i+1][0],tmp1=dp[i+1][1],d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][0]=tmp1+d;
        dp[i+1][1]=tmp0+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x)+abs(a.y-b.y);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    if(p[1].y==1)
    {
    	dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
		dp[1][1]=p[r[1]].x-1;
	}
	else
	{
		dp[1][0]=dis(Node(1,1),p[1]);
		dp[1][1]=dis(Node(1,1),p[r[1]]);
		dp[1][0]+=abs(p[l[1]].x-p[r[1]].x);
		dp[1][1]+=abs(p[l[1]].x-p[r[1]].x);
	}
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
        ll tmp0=dp[i+1][0],tmp1=dp[i+1][1],d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][0]=tmp1+d;
        dp[i+1][1]=tmp0+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


//QWsin
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;
typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
struct Node{
    int x,y;
    Node(int x=0,int y=0):x(x),y(y){}
    void input(){scanf("%d%d",&y,&x);}
    bool operator < (const Node &rhs)const{
        return y<rhs.y || (y==rhs.y && x<rhs.x);
    }
}p[maxn];

int col[maxn];
int l[maxn],r[maxn];

ll dp[maxn][2];
int n,m,k,q;
ll dis(Node a,Node b)
{
    int p1=lower_bound(col+1,col+q+1,a.x)-col;
    ll ret=1ll<<60;
    if(p1<=q){
        if(col[p1]<=b.x) return abs(a.x-b.x)+abs(a.y-b.y);
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    if(p1!=1){
        --p1;
        ret=min(ret,abs(a.x-col[p1])+abs(b.x-col[p1])+(ll)abs(a.y-b.y));
    }
    return ret;
}

int main()
{
    cin>>n>>m>>k>>q;
    rep(i,1,k) p[i].input();
    rep(i,1,q) scanf("%d",col+i);
    sort(p+1,p+k+1);
    sort(col+1,col+q+1);

    int top=0;
    rep(i,1,k)
    {
        int ed=i;
        while(ed+1<=k && p[ed+1].y==p[i].y) ++ed;
        l[++top]=i;r[top]=ed;
        i=ed;
    }

    memset(dp,1,sizeof dp);
    if(p[1].y==1)
    {
    	dp[1][0]=p[r[1]].x+p[r[1]].x-p[l[1]].x-1;
		dp[1][1]=p[r[1]].x-1;
	}
	else
	{
		dp[1][0]+=dis(Node(1,1),p[1]);
		dp[1][1]+=dis(Node(1,1),p[r[1]]);
	}
	rep(i,1,top-1)
    {
        dp[i+1][0]=min(dp[i][1]+dis(p[r[i]],p[l[i+1]]) , dp[i][0]+dis(p[l[i]],p[l[i+1]]));
        dp[i+1][1]=min(dp[i][1]+dis(p[r[i]],p[r[i+1]]) , dp[i][0]+dis(p[l[i]],p[r[i+1]]));
        ll tmp0=dp[i+1][0],tmp1=dp[i+1][1],d=abs(p[l[i+1]].x-p[r[i+1]].x);
        dp[i+1][0]=tmp1+d;
        dp[i+1][1]=tmp0+d;
    }
    cout<<min(dp[top][0],dp[top][1])<<endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != -1 && v[stop].empty()) stop--;
	if(stop == -1) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
		    if(q == 150000) {
		        cout << nl << " " << nr << endl;
		        cout << nld << " " << nrd << endl;
		    }
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != -1 && v[stop].empty()) stop--;
	if(stop == -1) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
		    if(q == 150000) cout << nld << " " << nrd << endl;
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(v[stop].empty()) stop--;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+nr-nl);
			nld = min(nld,p.s+abs(p.f-nr)+nr-nl);
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	v[0].pb(1);
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(v[stop].empty()) stop--;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+nr-nl);
			nld = min(nld,p.s+abs(p.f-nr)+nr-nl);
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(abs(*lp2-nl) < abs(nl-*lp1))
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else if(abs(*lp2-nl) > abs(nl-*lp1))
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(abs(*lp2-nr) < abs(nr-*lp1))
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else if(abs(*lp2-nr) > abs(nr-*lp1))
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != -1 && v[stop].empty()) stop--;
	if(stop == -1) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
		    if(k == 150000) cout << nld << " " << nrd << endl;
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != 0 && v[stop].empty()) stop--;
	cout << stop << endl;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != 0 && v[stop].empty()) stop--;
	if(stop == 0) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(v[stop].empty()) stop--;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+nr-nl);
			nld = min(nld,p.s+abs(p.f-nr)+nr-nl);
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(abs(*lp2-nl) < abs(nl-*lp1))
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else if(abs(*lp2-nl) > abs(nl-*lp1))
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(abs(*lp2-nr) < abs(nr-*lp1))
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else if(abs(*lp2-nr) > abs(nr-*lp1))
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	v[0].pb(1);
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(v[stop].empty()) stop--;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+nr-nl);
			nld = min(nld,p.s+abs(p.f-nr)+nr-nl);
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 != cols.end()) pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		if(lp2 != cols.begin()) pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 != cols.end()) pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		if(lp2 != cols.begin()) pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != -1 && v[stop].empty()) stop--;
	if(stop == -1) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != -1 && v[stop].empty()) stop--;
	if(stop == -1) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
		    if(q == 150000) {
		        for(auto x : pts) cout << x.f << " " << x.s << endl;
		        cout << nld << " " << nrd << endl;
		    }
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(stop != -1 && v[stop].empty()) stop--;
	if(stop == 0) {
		cout << 0 << endl;
		return 0;
	}
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+abs(nr-nl));
			nld = min(nld,p.s+abs(p.f-nr)+abs(nr-nl));
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(v[stop].empty()) stop--;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+nr-nl);
			nld = min(nld,p.s+abs(p.f-nr)+nr-nl);
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin()
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
	    else if(lp2 == cols.begin())
	        pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
	    else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define f first
#define s second
#define mp make_pair
#define pb push_back

///
ll alot = 987654321123456789LL;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m, k, q; cin >> n >> m >> k >> q;
	vector<vi> v(n);
	F0R(i, k) {
		int a, b; cin >> a >> b;
		v[a-1].pb(b);
	}
	F0R(i, n) sort(v[i].begin(), v[i].end());
	vector<pair<int,ll>> pts;
	pts.pb(mp(1,0));
	set<int> cols;
	F0R(i, q) {
		int a; cin >> a;
		cols.insert(a);
	}
	int stop = n-1;
	while(v[stop].empty()) stop--;
	int prow = 0;
	F0R(i, n) {
		if(v[i].empty()) continue;
		int nl = v[i][0], nr = v[i][v[i].size()-1];
		ll nld = alot, nrd = alot;
		for(auto p : pts) {
			nrd = min(nrd,p.s+abs(p.f-nl)+nr-nl);
			nld = min(nld,p.s+abs(p.f-nr)+nr-nl);
		}
		nld += i-prow;
		nrd += i-prow;
		if(stop==i) {
			cout << min(nld,nrd) << endl;
			break;
		}
		pts.clear();
		auto lp1 = cols.upper_bound(nl);
		auto lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
		else if(lp2 == cols.begin())
		    pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		else {
			pts.pb(mp(*lp1,abs(nl-*lp1)+nld));
			pts.pb(mp(*lp2,abs(nl-*lp2)+nld));
		}
		lp1 = cols.upper_bound(nr);
		lp2 = lp1--;
		if(lp2 == cols.end())
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
	    else if(lp2 == cols.begin())
	        pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
	    else {
			pts.pb(mp(*lp1,abs(nr-*lp1)+nrd));
			pts.pb(mp(*lp2,abs(nr-*lp2)+nrd));
		}
		prow = i;
	}
///
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int l[maxn],r[maxn];
vector<int>g[maxn];
int dp[2][maxn];
int n,m,k,q;
int safe[maxn];
int tmp1[maxn],tmp2[maxn];
void solve(){
    fo(i,2,n-1){
        if(r[i]==0){
            fo(j,1,m) dp[i^1][j]=dp[(i-1)^1][j];
            continue;
        }
        fo(j,0,m+1) {
            tmp1[j]=tmp2[j]=INF;dp[i^1][j]=INF;
        }
        fo(j,1,m){//第j列作为起点
            if(!safe[j]) continue;
            int lst=dp[(i-1)^1][j];
            if(j<l[i]) {
                tmp1[j] = lst +2*(r[i]-j);
                tmp2[j]=tmp1[j];
            }
            else if(j>r[i]){
                tmp1[j]=lst+2*(j-l[i]);
                tmp2[j]=tmp1[j];
            }
            else {
                tmp1[j]=lst+2*(r[i]-l[i]);
                tmp2[j]=tmp1[j];
            }

            fo(j,1,m){
                if(j<=r[i]){
                    tmp1[j]=min(tmp1[j],tmp1[j-1]-1);
                }
                else{
                    tmp1[j]=min(tmp1[j],tmp1[j-1]+1);
                }
            }
            fod(j,m,1){
                if(j>=l[i]) tmp2[j]=min(tmp2[j],tmp2[j+1]-1);
                else tmp2[j]=min(tmp2[j],tmp2[j+1]+1);
            }

            fo(j,1,m){
                if(safe[j]) {
                    dp[i^1][j]=min(tmp1[j],tmp2[j]);
                }
            }
        }
    }
}

int main(){
//    op;
    read(n);read(m);read(k);read(q);
    fo(i,1,n){
        g[i].resize(m+1);
        l[i]=INF;
    }
    fo(i,0,1){
        fo(j,1,m) dp[i][j]=INF;
    }
    fo(i,1,k){
        int x,y;
        read(x);read(y);
        l[x]=min(l[x],y);r[x]=max(r[x],y);
    }
    fo(i,1,q) {
        int x;
        read(x);safe[x]=1;
    }

    fo(i,1,m){
        if(!safe[i]) continue;
        if(i>=r[1]) dp[0][i]=i-1;
        else if(i<=l[1]){
            dp[0][i]=(r[1]-i)*2;
        }
        else {
            dp[0][i]=r[1]-l[1]+min(r[1]-i,i-l[i]);
        }
    }
    fod(i,n,1){
        if(r[i]){
            n=i;break;
        }
    }
    if(n==1){
        int ans=INF;
        fo(i,1,m) ans=min(ans,dp[1][i]);
        printf("%d\n",ans);
        return 0;
    }
    solve();
    int ans=INF;

    fo(i,1,m){
        int lst=dp[(n-1)^1][i];
        if(i<l[n]){
            ans=min(ans,lst+r[n]-i);
        }
        else if(i>r[n]){
            ans=min(ans,lst+i-l[n]);
        }
        else{
            int dis=r[n]-l[n]+min(r[n]-i,i-l[n]);
            ans=min(ans,lst+dis);
        }
    }

//    fo(i,1,n-1){
//        fo(j,1,m){
//            cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    printf("%d\n",ans+n-1);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int lb[maxn],rb[maxn];
vector<int>a[maxn];
int col[maxn];
LL dp[maxn][2];

LL calc(int y1,int y2,int line){
    return (LL)abs(y1-line)+abs(y2-line);
}

LL dis(int x1,int y1,int x2,int y2){
    LL distx=abs(x1-x2);
    LL disty=min(min(calc(y1,y2,lb[y1]),calc(y1,y2,lb[y2])),min(calc(y1,y2,rb[y1]),calc(y1,y2,rb[y2])));
    return distx+disty;
}

int n,m,k,q;

int main(){

    read(n);read(m);read(k);read(q);

    fo(i,1,k){
        int x,y;
        read(x);read(y);
        a[x].push_back(y);
    }
    fo(i,1,q){
        read(col[i]);
    }
    sort(col+1,col+1+q);
    col[0]=-INF;col[q+1]=INF;
    fo(i,1,m){
        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
    }

    sort(a[1].begin(),a[1].end());
    if(!a[1].empty()){
        dp[1][0]=dp[1][1]=a[1].back()-1;
        a[1][0]=a[1].back();
    }
    else{
        a[1].push_back(1);
        dp[1][0]=dp[1][1]=0;
    }

    int lst=1;
    fo(i,2,n){
        if(!a[i].empty()){
            sort(a[i].begin(),a[i].end());
            int l_to_l=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].front());
            int r_to_l=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].front());
            int l_to_r=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].back());
            int r_to_r=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].back());
            LL len=a[i].back()-a[i].front();
            dp[i][0]=min(l_to_r,r_to_r)+len;
            dp[i][1]=min(l_to_l,r_to_l)+len;
            lst=i;
        }
    }
    cout<<min(dp[lst][0],dp[lst][1])<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int l[maxn],r[maxn];
vector<int>g[maxn];
int dp[2][maxn];
int n,m,k,q;
int safe[maxn];
int tmp1[maxn],tmp2[maxn];
void solve(){
    fo(i,2,n-1){
        if(r[i]==0){
            fo(j,1,m) dp[i&1][j]=dp[(i-1)&1][j];
            continue;
        }
        fo(j,0,m+1) {
            tmp1[j]=tmp2[j]=INF;dp[i&1][j]=INF;
        }
        fo(j,1,m){//第j列作为起点
            if(!safe[j]) continue;
            int lst=dp[(i-1)&1][j];
            if(j<l[i]) {
                tmp1[j] = lst +2*(r[i]-j);
                tmp2[j]=tmp1[j];
            }
            else if(j>r[i]){
                tmp1[j]=lst+2*(j-l[i]);
                tmp2[j]=tmp1[j];
            }
            else {
                tmp1[j]=lst+2*(r[i]-l[i]);
                tmp2[j]=tmp1[j];
            }

            fo(j,1,m){
                if(j<=r[i]){
                    tmp1[j]=min(tmp1[j],tmp1[j-1]-1);
                }
                else{
                    tmp1[j]=min(tmp1[j],tmp1[j-1]+1);
                }
            }
            fod(j,m,1){
                if(j>=l[i]) tmp2[j]=min(tmp2[j],tmp2[j+1]-1);
                else tmp2[j]=min(tmp2[j],tmp2[j+1]+1);
            }

            fo(j,1,m){
                if(safe[j]) {
                    dp[i&1][j]=min(tmp1[j],tmp2[j]);
                }
            }
        }
    }
}

int main(){
    //op;
    read(n);read(m);read(k);read(q);
    fo(i,1,n){
        g[i].resize(m+1);
        l[i]=INF;
    }
    fo(i,0,1){
        fo(j,1,m) dp[i][j]=INF;
    }
    fo(i,1,k){
        int x,y;
        read(x);read(y);
        l[x]=min(l[x],y);r[x]=max(r[x],y);
    }
    fo(i,1,q) {
        int x;
        read(x);safe[x]=1;
    }

    fo(i,1,m){
        if(!safe[i]) continue;
        if(i>=r[1]) dp[1][i]=i-1;
        else if(i<=l[1]){
            dp[1][i]=(r[1]-i)*2;
        }
        else {
            dp[1][i]=r[1]-l[1]+min(r[1]-i,i-l[i]);
        }
    }
    fod(i,n,1){
        if(r[i]){
            n=i;break;
        }
    }
    if(n==1){
        int ans=INF;
        fo(i,1,m) ans=min(ans,dp[1][i]);
        printf("%d\n",ans);
        return 0;
    }
    solve();
    int ans=INF;

    fo(i,1,m){
        int lst=dp[(n-1)&1][i];
        if(i<l[n]){
            ans=min(ans,lst+r[n]-i);
        }
        else if(i>r[n]){
            ans=min(ans,lst+i-l[n]);
        }
        else{
            int dis=r[n]-l[n]+min(r[n]-i,i-l[n]);
            ans=min(ans,lst+dis);
        }
    }

//    fo(i,1,n-1){
//        fo(j,1,m){
//            cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    printf("%d\n",ans+n-1);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int l[maxn],r[maxn];
int dp[2][maxn];
int n,m,k,q;
int safe[maxn];
int tmp1[maxn],tmp2[maxn];
void solve(){
    fo(i,2,n-1){
        if(r[i]==0){
            fo(j,1,m) dp[i&1][j]=dp[(i-1)&1][j];
            continue;
        }
        fo(j,0,m+1) {
            tmp1[j]=tmp2[j]=INF;dp[i&1][j]=INF;
        }
        fo(j,1,m){//第j列作为起点
            if(!safe[j]) continue;
            int lst=dp[(i-1)&1][j];
            if(j<l[i]) {
                tmp1[j] = lst +2*(r[i]-j);
                tmp2[j]=tmp1[j];
            }
            else if(j>r[i]){
                tmp1[j]=lst+2*(j-l[i]);
                tmp2[j]=tmp1[j];
            }
            else {
                tmp1[j]=lst+2*(r[i]-l[i]);
                tmp2[j]=tmp1[j];
            }

            fo(j,1,m){
                if(j<=r[i]){
                    tmp1[j]=min(tmp1[j],tmp1[j-1]-1);
                }
                else{
                    tmp1[j]=min(tmp1[j],tmp1[j-1]+1);
                }
            }
            fod(j,m,1){
                if(j>=l[i]) tmp2[j]=min(tmp2[j],tmp2[j+1]-1);
                else tmp2[j]=min(tmp2[j],tmp2[j+1]+1);
            }

            fo(j,1,m){
                if(safe[j]) {
                    dp[i&1][j]=min(tmp1[j],tmp2[j]);
                }
            }
        }
    }
}

int main(){
    //op;
    read(n);read(m);read(k);read(q);
    fo(i,1,n){
        l[i]=INF;
    }
    fo(i,0,1){
        fo(j,1,m) dp[i][j]=INF;
    }
    fo(i,1,k){
        int x,y;
        read(x);read(y);
        l[x]=min(l[x],y);r[x]=max(r[x],y);
    }
    fo(i,1,q) {
        int x;
        read(x);safe[x]=1;
    }

    fo(i,1,m){
        if(!safe[i]) continue;
        if(i>=r[1]) dp[1][i]=i-1;
        else if(i<=l[1]){
            dp[1][i]=(r[1]-i)*2;
        }
        else {
            dp[1][i]=r[1]-l[1]+min(r[1]-i,i-l[i]);
        }
    }
    fod(i,n,1){
        if(r[i]){
            n=i;break;
        }
    }
    if(n==1){
        int ans=INF;
        fo(i,1,m) ans=min(ans,dp[1][i]);
        printf("%d\n",ans);
        return 0;
    }
    solve();
    int ans=INF;

    fo(i,1,m){
        int lst=dp[(n-1)&1][i];
        if(i<l[n]){
            ans=min(ans,lst+r[n]-i);
        }
        else if(i>r[n]){
            ans=min(ans,lst+i-l[n]);
        }
        else{
            int dis=r[n]-l[n]+min(r[n]-i,i-l[n]);
            ans=min(ans,lst+dis);
        }
    }

    printf("%d\n",ans+n-1);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int l[maxn],r[maxn];
vector<int>g[maxn];
vector<int>dp[maxn];
int n,m,k,q;
int safe[maxn];
int tmp1[maxn],tmp2[maxn];
void solve(){
    fo(i,2,n-1){
        if(r[i]==0){
            fo(j,1,m) dp[i][j]=dp[i-1][j];
            continue;
        }
        fo(j,0,m+1) tmp1[j]=tmp2[j]=INF;
        fo(j,1,m){//第j列作为起点
            if(!safe[j]) continue;
            if(j<l[i]) {
                tmp1[j] = dp[i - 1][j] +2*(r[i]-j);
                tmp2[j]=tmp1[j];
            }
            else if(j>r[i]){
                tmp1[j]=dp[i-1][j]+2*(j-l[i]);
                tmp2[j]=tmp1[j];
            }
            else {
                tmp1[j]=dp[i-1][j]+2*(r[i]-l[i]);
                tmp2[j]=tmp1[j];
            }

            fo(j,1,m){
                if(j<=r[i]){
                    tmp1[j]=min(tmp1[j],tmp1[j-1]-1);
                }
                else{
                    tmp1[j]=min(tmp1[j],tmp1[j-1]+1);
                }
            }
            fod(j,m,1){
                if(j>=l[i]) tmp2[j]=min(tmp2[j],tmp2[j+1]-1);
                else tmp2[j]=min(tmp2[j],tmp2[j+1]+1);
            }

            fo(j,1,m){
                if(safe[j]) {
                    dp[i][j]=min(tmp1[j],tmp2[j]);
                }
            }
        }
    }
}

int main(){
//    op;
    read(n);read(m);read(k);read(q);
    fo(i,1,n){
        g[i].resize(m+1);
        dp[i].resize(m+1);
        l[i]=INF;
    }
    fo(i,1,n){
        fo(j,1,m) dp[i][j]=INF;
    }
    fo(i,1,k){
        int x,y;
        read(x);read(y);
        l[x]=min(l[x],y);r[x]=max(r[x],y);
    }
    fo(i,1,q) {
        int x;
        read(x);safe[x]=1;
    }

    fo(i,1,m){
        if(!safe[i]) continue;
        if(i>=r[1]) dp[1][i]=i-1;
        else if(i<l[1]){
            dp[1][i]=(r[1]-i)*2;
        }
        else {
            dp[1][i]=r[1]-l[1]-max(r[1]-i,i-l[i]);
        }
    }
    solve();
    int ans=INF;

    fo(i,1,m){
        int lst=dp[n-1][i];
        if(i<l[i]){
            ans=min(ans,lst+r[n]-i);
        }
        else if(i>r[i]){
            ans=min(ans,lst+i-l[n]);
        }
        else{
            int dis=r[n]-l[n]-max(r[n]-i,i-l[n]);
        }
    }

//    fo(i,1,n-1){
//        fo(j,1,m){
//            cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    printf("%d\n",ans+n-1);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int l[maxn],r[maxn];
vector<int>g[maxn];
int dp[2][maxn];
int n,m,k,q;
int safe[maxn];
int tmp1[maxn],tmp2[maxn];
void solve(){
    fo(i,2,n-1){
        if(r[i]==0){
            fo(j,1,m) dp[i^1][j]=dp[(i-1)^1][j];
            continue;
        }
        fo(j,0,m+1) {
            tmp1[j]=tmp2[j]=INF;dp[i^1][j]=INF;
        }
        fo(j,1,m){//第j列作为起点
            if(!safe[j]) continue;
            int lst=dp[(i-1)^1][j];
            if(j<l[i]) {
                tmp1[j] = lst +2*(r[i]-j);
                tmp2[j]=tmp1[j];
            }
            else if(j>r[i]){
                tmp1[j]=lst+2*(j-l[i]);
                tmp2[j]=tmp1[j];
            }
            else {
                tmp1[j]=lst+2*(r[i]-l[i]);
                tmp2[j]=tmp1[j];
            }

            fo(j,1,m){
                if(j<=r[i]){
                    tmp1[j]=min(tmp1[j],tmp1[j-1]-1);
                }
                else{
                    tmp1[j]=min(tmp1[j],tmp1[j-1]+1);
                }
            }
            fod(j,m,1){
                if(j>=l[i]) tmp2[j]=min(tmp2[j],tmp2[j+1]-1);
                else tmp2[j]=min(tmp2[j],tmp2[j+1]+1);
            }

            fo(j,1,m){
                if(safe[j]) {
                    dp[i^1][j]=min(tmp1[j],tmp2[j]);
                }
            }
        }
    }
}

int main(){
//    op;
    read(n);read(m);read(k);read(q);
    fo(i,1,n){
        g[i].resize(m+1);
        l[i]=INF;
    }
    fo(i,0,1){
        fo(j,1,m) dp[i][j]=INF;
    }
    fo(i,1,k){
        int x,y;
        read(x);read(y);
        l[x]=min(l[x],y);r[x]=max(r[x],y);
    }
    fo(i,1,q) {
        int x;
        read(x);safe[x]=1;
    }

    fo(i,1,m){
        if(!safe[i]) continue;
        if(i>=r[1]) dp[1][i]=i-1;
        else if(i<=l[1]){
            dp[1][i]=(r[1]-i)*2;
        }
        else {
            dp[1][i]=r[1]-l[1]+min(r[1]-i,i-l[i]);
        }
    }

    fod(i,n,1){
        if(r[i]){
            n=i;break;
        }
    }
    if(n==1){
        int ans=INF;
        fo(i,1,m) ans=min(ans,dp[1][i]);
        printf("%d\n",ans);
        return 0;
    }
    solve();
    int ans=INF;

    fo(i,1,m){
        int lst=dp[(n-1)^1][i];
        if(i<l[n]){
            ans=min(ans,lst+r[n]-i);
        }
        else if(i>r[n]){
            ans=min(ans,lst+i-l[n]);
        }
        else{
            int dis=r[n]-l[n]+min(r[n]-i,i-l[n]);
            ans=min(ans,lst+dis);
        }
    }

//    fo(i,1,n-1){
//        fo(j,1,m){
//            cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    printf("%d\n",ans+n-1);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int l[maxn],r[maxn];
vector<int>g[maxn];
int dp[2][maxn];
int n,m,k,q;
int safe[maxn];
int tmp1[maxn],tmp2[maxn];
void solve(){
    fo(i,2,n-1){
        if(r[i]==0){
            fo(j,1,m) dp[i^1][j]=dp[(i-1)^1][j];
            continue;
        }
        fo(j,0,m+1) {
            tmp1[j]=tmp2[j]=INF;dp[i^1][j]=INF;
        }
        fo(j,1,m){//第j列作为起点
            if(!safe[j]) continue;
            int lst=dp[(i-1)^1][j];
            if(j<l[i]) {
                tmp1[j] = lst +2*(r[i]-j);
                tmp2[j]=tmp1[j];
            }
            else if(j>r[i]){
                tmp1[j]=lst+2*(j-l[i]);
                tmp2[j]=tmp1[j];
            }
            else {
                tmp1[j]=lst+2*(r[i]-l[i]);
                tmp2[j]=tmp1[j];
            }

            fo(j,1,m){
                if(j<=r[i]){
                    tmp1[j]=min(tmp1[j],tmp1[j-1]-1);
                }
                else{
                    tmp1[j]=min(tmp1[j],tmp1[j-1]+1);
                }
            }
            fod(j,m,1){
                if(j>=l[i]) tmp2[j]=min(tmp2[j],tmp2[j+1]-1);
                else tmp2[j]=min(tmp2[j],tmp2[j+1]+1);
            }

            fo(j,1,m){
                if(safe[j]) {
                    dp[i^1][j]=min(tmp1[j],tmp2[j]);
                }
            }
        }
    }
}

int main(){
//    op;
    read(n);read(m);read(k);read(q);
    fo(i,1,n){
        g[i].resize(m+1);
        l[i]=INF;
    }
    fo(i,0,1){
        fo(j,1,m) dp[i][j]=INF;
    }
    fo(i,1,k){
        int x,y;
        read(x);read(y);
        l[x]=min(l[x],y);r[x]=max(r[x],y);
    }
    fo(i,1,q) {
        int x;
        read(x);safe[x]=1;
    }

    fo(i,1,m){
        if(!safe[i]) continue;
        if(i>=r[1]) dp[0][i]=i-1;
        else if(i<=l[1]){
            dp[0][i]=(r[1]-i)*2;
        }
        else {
            dp[0][i]=r[1]-l[1]+min(r[1]-i,i-l[i]);
        }
    }
    fod(i,n,1){
        if(r[i]){
            n=i;break;
        }
    }
    if(n==1){
        int ans=INF;
        fo(i,1,m) ans=min(ans,dp[0][i]);
        printf("%d\n",ans);
        return 0;
    }
    solve();
    int ans=INF;

    fo(i,1,m){
        int lst=dp[(n-1)^1][i];
        if(i<l[n]){
            ans=min(ans,lst+r[n]-i);
        }
        else if(i>r[n]){
            ans=min(ans,lst+i-l[n]);
        }
        else{
            int dis=r[n]-l[n]+min(r[n]-i,i-l[n]);
            ans=min(ans,lst+dis);
        }
    }

//    fo(i,1,n-1){
//        fo(j,1,m){
//            cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    printf("%d\n",ans+n-1);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define maxn 200000
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
int n,m,k,q;
vector<int>a[maxn+5];
int lb[maxn+5],rb[maxn+5];
int col[maxn+5];
ll dp[maxn+5][2];//走到最左侧/最右侧结束
ll calc(int y1,int y2,int line){//从y1到第line列，走上去，再到y2
    return (ll)abs(y1-line)+abs(y2-line);
}
ll dist(int x1,int y1,int x2,int y2){
    ll distx=abs(x1-x2);
    ll disty=min(min(calc(y1,y2,lb[y1]),calc(y1,y2,lb[y2])),min(calc(y1,y2,rb[y1]),calc(y1,y2,rb[y2])));
    return distx+disty;
}
int main(){
    int x,y;
    scanf("%d %d %d %d",&n,&m,&k,&q);
    for(int i=1;i<=k;i++){
        scanf("%d %d",&x,&y);
        a[x].push_back(y);
    }
    for(int i=1;i<=q;i++){
        scanf("%d",&col[i]);
    }
    sort(col+1,col+1+q);
    col[0]=-INF;
    col[q+1]=INF;
    for(int i=1;i<=m;i++){
        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
    }

    sort(a[1].begin(),a[1].end());
    if(!a[1].empty()){
        dp[1][0]=dp[1][1]=a[1].back()-1;
        a[1][0]=a[1].back();
        //第一行必须从最后一个关键点往上走，否则就走不完所有关键点
    }else{
        a[1].push_back(1);
        dp[1][0]=dp[1][1]=0;
    }
    int last=1;
    for(int i=2;i<=n;i++){
        if(!a[i].empty()){
            sort(a[i].begin(),a[i].end());
            ll l_to_l=dp[last][0]+dist(last,a[last].front(),i,a[i].front());//从pre行最左侧走到i行最左侧
            ll r_to_l=dp[last][1]+dist(last,a[last].back(),i,a[i].front()); //从pre行最右侧走到i行最左侧
            ll l_to_r=dp[last][0]+dist(last,a[last].front(),i,a[i].back());//从pre行最左侧走到i行最右侧
            ll r_to_r=dp[last][1]+dist(last,a[last].back(),i,a[i].back());//从pre行最右侧走到i行最右侧
            ll now=a[i].back()-a[i].front();//走完当前行的代价
            dp[i][0]=min(l_to_r,r_to_r)+now;//先走到最右侧，最后到最左侧
            dp[i][1]=min(l_to_l,r_to_l)+now;//先走到最左侧，最后到最右侧
            last=i;
        }
    }
    printf("%I64d\n",min(dp[last][0],dp[last][1]));

}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int lb[maxn],rb[maxn];
vector<int>a[maxn];
int col[maxn];
LL dp[maxn][2];

int calc(int y1,int y2,int line){
    return abs(y1-line)+abs(y2-line);
}

int dis(int x1,int y1,int x2,int y2){
    int distx=abs(x1-x2);
    int disty=min(min(calc(y1,y2,lb[y1]) , calc(y1,y2,lb[y2])),min(calc(y1,y2,rb[y1]),calc(y1,y2,rb[y2])));
    return distx+disty;
}

int n,m,k,q;

int main(){
    read(n);read(m);read(k);read(q);

    fo(i,1,k){
        int x,y;
        read(x);read(y);
        a[x].push_back(y);
    }
    fo(i,1,q){
        read(col[i]);
    }
    sort(col+1,col+1+q);
    col[0]=-INF;col[q+1]=INF;
    fo(i,1,m){
        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
    }

    sort(a[1].begin(),a[1].end());
    if(!a[1].empty()){
        dp[1][0]=dp[1][1]=a[1].back()-1;
        a[1][0]=a[1].back();
    }
    else{
        a[1].push_back(1);
        dp[1][0]=dp[1][1]=0;
    }

    int lst=1;
    fo(i,2,n){
        if(!a[i].empty()){
            sort(a[i].begin(),a[i].end());
            int l_to_l=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].front());
            int r_to_l=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].front());
            int l_to_r=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].back());
            int r_to_r=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].back());
            int len=a[i].back()-a[i].front();
            dp[i][0]=min(l_to_r,r_to_r)+len;
            dp[i][1]=min(l_to_l,r_to_l)+len;
            lst=i;
        }
    }
    printf("%lld\n",min(dp[lst][0],dp[lst][1]));

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 2e6 + 100;
const int mod = 998244353;

int lb[maxn],rb[maxn];
vector<int>a[maxn];
int col[maxn];
LL dp[maxn][2];

LL calc(int y1,int y2,int line){
    return (LL)abs(y1-line)+abs(y2-line);
}

LL dis(int x1,int y1,int x2,int y2){
    LL distx=abs(x1-x2);
    LL disty=min(min(calc(y1,y2,lb[y1]),calc(y1,y2,lb[y2])),min(calc(y1,y2,rb[y1]),calc(y1,y2,rb[y2])));
    return distx+disty;
}

int n,m,k,q;

int main(){

//    op;

    read(n);read(m);read(k);read(q);

    fo(i,1,k){
        int x,y;
        read(x);read(y);
        a[x].push_back(y);
    }
//    for(int i=1;i<=q;i++){
//        scanf("%d",&col[i]);
//    }
//    sort(col+1,col+1+q);
//    col[0]=-INF;
//    col[q+1]=INF;
//    for(int i=1;i<=m;i++){
//        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
//        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
//    }
//
//    sort(a[1].begin(),a[1].end());
//    if(!a[1].empty()){
//        dp[1][0]=dp[1][1]=a[1].back()-1;
//        a[1][0]=a[1].back();
//    }else{
//        a[1].push_back(1);
//        dp[1][0]=dp[1][1]=0;
//    }
//    int last=1;
//    for(int i=2;i<=n;i++){
//        if(!a[i].empty()){
//            sort(a[i].begin(),a[i].end());
//            ll l_to_l=dp[last][0]+dis(last,a[last].front(),i,a[i].front());
//            ll r_to_l=dp[last][1]+dis(last,a[last].back(),i,a[i].front());
//            ll l_to_r=dp[last][0]+dis(last,a[last].front(),i,a[i].back());
//            ll r_to_r=dp[last][1]+dis(last,a[last].back(),i,a[i].back());
//            ll now=a[i].back()-a[i].front();
//            dp[i][0]=min(l_to_r,r_to_r)+now;
//            dp[i][1]=min(l_to_l,r_to_l)+now;
//            last=i;
//        }
//    }
//    printf("%I64d\n",min(dp[last][0],dp[last][1]));
    fo(i,1,q){
        read(col[i]);
    }
    sort(col+1,col+1+q);
    col[0]=-INF;col[q+1]=INF;
    fo(i,1,m){
        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
    }

    sort(a[1].begin(),a[1].end());
    if(!a[1].empty()){
        dp[1][0]=dp[1][1]=a[1].back()-1;
        a[1][0]=a[1].back();
    }
    else{
        a[1].push_back(1);
        dp[1][0]=dp[1][1]=0;
    }

    int lst=1;
    fo(i,2,n){
        if(!a[i].empty()){
            sort(a[i].begin(),a[i].end());
            LL l_to_l=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].front());
            LL r_to_l=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].front());
            LL l_to_r=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].back());
            LL r_to_r=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].back());
            LL len=a[i].back()-a[i].front();
            dp[i][0]=min(l_to_r,r_to_r)+len;
            dp[i][1]=min(l_to_l,r_to_l)+len;
            lst=i;
        }
    }
    cout<<min(dp[lst][0],dp[lst][1])<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int lb[maxn],rb[maxn];
vector<int>a[maxn];
int col[maxn];
LL dp[maxn][2];

LL calc(int y1,int y2,int line){
    return (LL)abs(y1-line)+abs(y2-line);
}

LL dis(int x1,int y1,int x2,int y2){
    LL distx=abs(x1-x2);
    LL disty=min(min(calc(y1,y2,lb[y1]) , calc(y1,y2,lb[y2])),min(calc(y1,y2,rb[y1]),calc(y1,y2,rb[y2])));
    return distx+disty;
}

int n,m,k,q;

int main(){

    read(n);read(m);read(k);read(q);

    fo(i,1,k){
        int x,y;
        read(x);read(y);
        a[x].push_back(y);
    }
    fo(i,1,q){
        read(col[i]);
    }
    sort(col+1,col+1+q);
    col[0]=-INF;col[q+1]=INF;
    fo(i,1,m){
        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
    }

    sort(a[1].begin(),a[1].end());
    if(!a[1].empty()){
        dp[1][0]=dp[1][1]=a[1].back()-1;
        a[1][0]=a[1].back();
    }
    else{
        a[1].push_back(1);
        dp[1][0]=dp[1][1]=0;
    }

    int lst=1;
    fo(i,2,n){
        if(!a[i].empty()){
            sort(a[i].begin(),a[i].end());
            int l_to_l=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].front());
            int r_to_l=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].front());
            int l_to_r=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].back());
            int r_to_r=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].back());
            int len=a[i].back()-a[i].front();
            dp[i][0]=min(l_to_r,r_to_r)+len;
            dp[i][1]=min(l_to_l,r_to_l)+len;
            lst=i;
        }
    }
    printf("%lld\n",min(dp[lst][0],dp[lst][1]));

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt","r",stdin);
#define read(a) scanf("%d",&a)
const int INF = 0x3f3f3f3f;
typedef long long LL;
#define mp(x,y) make_pair(x,y)
#define pii pair<int,int>
const int maxn = 1e6 + 100;
const int mod = 998244353;

int lb[maxn],rb[maxn];
vector<int>a[maxn];
int col[maxn];
LL dp[maxn][2];

LL calc(int y1,int y2,int line){
    return (LL)abs(y1-line)+abs(y2-line);
}

LL dis(int x1,int y1,int x2,int y2){
    LL distx=abs(x1-x2);
    LL disty=min(min(calc(y1,y2,lb[y1]),calc(y1,y2,lb[y2])),min(calc(y1,y2,rb[y1]),calc(y1,y2,rb[y2])));
    return distx+disty;
}

int n,m,k,q;

int main(){

    read(n);read(m);read(k);read(q);

    fo(i,1,k){
        int x,y;
        read(x);read(y);
        a[x].push_back(y);
    }
    fo(i,1,q){
        read(col[i]);
    }
    sort(col+1,col+1+q);
    col[0]=-INF;col[q+1]=INF;
    fo(i,1,m){
        lb[i]=col[lower_bound(col+1,col+1+q,i)-col-1];
        rb[i]=col[lower_bound(col+1,col+1+q,i)-col];
    }

    sort(a[1].begin(),a[1].end());
    if(!a[1].empty()){
        dp[1][0]=dp[1][1]=a[1].back()-1;
        a[1][0]=a[1].back();
    }
    else{
        a[1].push_back(1);
        dp[1][0]=dp[1][1]=0;
    }

    int lst=1;
    fo(i,2,n){
        if(!a[i].empty()){
            sort(a[i].begin(),a[i].end());
            int l_to_l=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].front());
            int r_to_l=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].front());
            int l_to_r=dp[lst][0]+dis(lst,a[lst].front(),i,a[i].back());
            int r_to_r=dp[lst][1]+dis(lst,a[lst].back(),i,a[i].back());
            LL len=a[i].back()-a[i].front();
            dp[i][0]=min(l_to_r,r_to_r)+len;
            dp[i][1]=min(l_to_l,r_to_l)+len;
            lst=i;
        }
    }
    printf("%lld\n",min(dp[lst][0],dp[lst][1]));

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};

ll n, m, k, q, line[DIM][2], safe[DIM], D[DIM][2];
ll lo(ll x) {
	auto it = upper_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	pos--;
	if (pos > 0)return safe[pos];
	else return safe[pos+1];
}
ll up(ll x) {
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos <= q)return safe[pos];
	else return safe[pos - 1];
}
int main() {
	cin >> n >> m >> k >> q;
	for (ll i = 0; i < DIM; i++) {
		line[i][0] = INF;
		line[i][1] = -1;
	}
	ll end = -1;
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		line[x][0] = min(line[x][0], y);
		line[x][1] = max(line[x][1], y);
		end = max(end, x);
	}
	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	D[1][0] = line[1][1] - 1 + line[1][1] - line[1][0];
	D[1][1] = line[1][1] - 1;
	if (line[1][1] == -1) {
		line[1][1] = 1;
		line[1][0] = 1;
	}
	for (ll i = 2; i <= end; i++) {
		if (line[i][1] == -1) {
			line[i][1] = line[i - 1][1];
			line[i][0] = line[i - 1][0];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}
		D[i][0] = line[i][1] - line[i][0];
		D[i][1] = D[i][0];
		pp r = { lo(line[i][1]),up(line[i][1]) }, l = { lo(line[i][0]),up(line[i][0]) };
		ll m1, m2;
		m1 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][0] - r.sc) + abs(r.sc - line[i][1]));
		m1 = min(m1, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][1] - r.sc) + abs(line[i][1] - r.sc)));
		m2 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][0] - l.sc) + abs(l.sc - line[i][0]));
		m2 = min(m2, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][1] - l.sc) + abs(l.sc - line[i][0])));
		D[i][0] += m1;
		D[i][1] += m2;
	}
	cout << min(D[end][0], D[end][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};

ll n, m, k, q, line[DIM][2], safe[DIM], D[DIM][2];
ll lo(ll x) {
	auto it = upper_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	pos--;
	if (pos > 0)return safe[pos];
	else return safe[pos+1];
}
ll up(ll x) {
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos <= q)return safe[pos];
	else return safe[pos - 1];
}
int main() {
	cin >> n >> m >> k >> q;
	for (ll i = 0; i < DIM; i++) {
		line[i][0] = INF;
		line[i][1] = -1;
	}
	ll end = -1;
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		line[x][0] = min(line[x][0], y);
		line[x][1] = max(line[x][1], y);
		end = max(end, x);
	}
	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	D[1][0] = line[1][1] - 1 + line[1][1] - line[1][0];
	D[1][1] = line[1][1] - 1;
	for (ll i = 2; i <= end; i++) {
		if (line[i][1] == -1) {
			line[i][1] = line[i - 1][1];
			line[i][0] = line[i - 1][0];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}
		D[i][0] = line[i][1] - line[i][0];
		D[i][1] = D[i][0];
		pp r = { lo(line[i][1]),up(line[i][1]) }, l = { lo(line[i][0]),up(line[i][0]) };
		ll m1, m2;
		m1 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][0] - r.sc) + abs(r.sc - line[i][1]));
		m1 = min(m1, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][1] - r.sc) + abs(line[i][1] - r.sc)));
		m2 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][0] - l.sc) + abs(l.sc - line[i][0]));
		m2 = min(m2, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][1] - l.sc) + abs(l.sc - line[i][0])));
		D[i][0] += m1;
		D[i][1] += m2;
	}
	cout << min(D[end][0], D[end][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};
struct node {
	ll fi, sc, th;
};
ll n, m, k, q, safe[DIM], dot[DIM][2], D[DIM][2];
node lb(ll x) {
	node res;
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos + 1 > q)res.th = INF;
	else res.th = safe[pos + 1];
	if (pos > q)res.sc = INF;
	else res.sc = safe[pos];
	if (pos - 1 < 1)res.fi = INF;
	else res.fi = safe[pos - 1];
	return res;
}
int main() {
	cin >> n >> m >> k >> q;
	ll to = 0;
	for (ll i = 1; i < DIM; i++) {
		dot[i][0] = INF;
		dot[i][1] = -1;
	}
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		dot[x][0] = min(dot[x][0], y);
		dot[x][1] = max(dot[x][1], y);
		to = max(x, to);
	}

	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	ll left = 1, right = 1;
	if (dot[1][1] == -1) {
		dot[1][0] = dot[1][1] = 1;
	}
	D[1][0] = dot[1][0] - 1 + abs(dot[1][0] - dot[1][1]) * 2;
	D[1][1] = dot[1][0] - 1 + abs(dot[1][0] - dot[1][1]);
	for (ll i = 2; i <= to; i++) {
		if (dot[i][1] == -1) {
			dot[i][0] = dot[i - 1][0];
			dot[i][1] = dot[i - 1][1];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}

		node l = lb(dot[i][0]), r = lb(dot[i][1]);
		D[i][0] = abs(dot[i][0] - dot[i][1]);
		D[i][1] = abs(dot[i][0] - dot[i][1]);
		D[i][0] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0] - r.fi) + abs(dot[i][1] - r.fi), abs(dot[i - 1][0] - r.th) + abs(dot[i][1] - r.th)), abs(dot[i - 1][0] - r.sc) + abs(dot[i][1] - r.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - r.fi) + abs(dot[i][1] - r.fi), abs(dot[i - 1][1] - r.th) + abs(dot[i][1] - r.th)), abs(dot[i - 1][1] - r.sc) + abs(dot[i][1] - r.sc)) + 1);
		D[i][1] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][0] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][0] - l.sc) + abs(dot[0][1] - l.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][1] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][1] - l.sc) + abs(dot[i][0] - l.sc)) + 1);

	}
	cout << min(D[to][0], D[to][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};
struct node {
	ll fi, sc, th;
};
ll n, m, k, q,safe[DIM],dot[DIM][2],D[DIM][2];
node lb(ll x) {
	node res;
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos + 1 > q)res.th = INF;
	else res.th = safe[pos + 1];
	if (pos > q)res.sc = INF;
	else res.sc = safe[pos];
	if (pos - 1 < 1)res.fi = INF;
	else res.fi = safe[pos - 1];
	return res;
}
int main() {
	cin >> n >> m >> k >> q;
	ll to = 0;
	for (ll i = 1; i < DIM; i++) {
		dot[i][0] = INF;
		dot[i][1] = -1;
	}
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		dot[x][0] = min(dot[x][0], y);
		dot[x][1] = max(dot[x][1], y);
		to = max(x,to);
	}

	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	ll left = 1, right = 1;
	dot[0][0] = 1;
	dot[0][1] = 1;
	D[0][0] = -1;
	D[0][1] = -1;
	D[1][0] = dot[1][0]-1+abs(dot[1][0] - dot[1][1])*2;
	D[1][1] = dot[1][0]-1+abs(dot[1][0] - dot[1][1]) ;
	for (ll i = 2; i <= to; i++) {
		if (dot[i][1] == -1) {
			dot[i][0] = dot[i - 1][0];
			dot[i][1] = dot[i - 1][1];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}

		node l = lb(dot[i][0]), r = lb(dot[i][1]);
		D[i][0] = abs(dot[i][0] - dot[i][1]);
		D[i][1] = abs(dot[i][0] - dot[i][1]);
		D[i][0] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0]-r.fi)+abs(dot[i][1]-r.fi),abs(dot[i-1][0]-r.th)+abs(dot[i][1]-r.th)),abs(dot[i-1][0]-r.sc)+abs(dot[i][1]-r.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - r.fi) + abs(dot[i][1] - r.fi), abs(dot[i - 1][1] - r.th) + abs(dot[i][1] - r.th)), abs(dot[i - 1][1] - r.sc) + abs(dot[i][1] - r.sc)) + 1);
		D[i][1] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0] - l.fi) + abs(dot[i][0] - l.fi),abs(dot[i-1][0]-l.th)+abs(dot[i][0]-l.th)), abs(dot[i - 1][0] - l.sc) + abs(dot[i][0] - l.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][1] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][1] - l.sc) + abs(dot[i][0] - l.sc)) + 1);

	}
	cout << min(D[to][0], D[to][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};

ll n, m, k, q, line[DIM][2], safe[DIM], D[DIM][2];
ll lo(ll x) {
	auto it = upper_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	pos--;
	if (pos > 0)return safe[pos];
	else return safe[pos+1];
}
ll up(ll x) {
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos <= q)return safe[pos];
	else return safe[pos - 1];
}
int main() {
	cin >> n >> m >> k >> q;
	for (ll i = 0; i < DIM; i++) {
		line[i][0] = INF;
		line[i][1] = -1;
	}
	ll end = -1;
	forn(i, n) {
		ll x, y;
		cin >> x >> y;
		line[x][0] = min(line[x][0], y);
		line[x][1] = max(line[x][1], y);
		end = max(end, x);
	}
	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	D[1][0] = line[1][1] - 1 + line[1][1] - line[1][0];
	D[1][1] = line[1][1] - 1;
	for (ll i = 2; i <= end; i++) {
		if (line[i][1] == -1) {
			line[i][1] = line[i - 1][1];
			line[i][0] = line[i - 1][0];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}
		D[i][0] = line[i][1] - line[i][0];
		D[i][1] = D[i][0];
		pp r = { lo(line[i][1]),up(line[i][1]) }, l = { lo(line[i][0]),up(line[i][0]) };
		ll m1, m2;
		m1 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][0] - r.sc) + abs(r.sc - line[i][1]));
		m1 = min(m1, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][1] - r.sc) + abs(line[i][1] - r.sc)));
		m2 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][0] - l.sc) + abs(l.sc - line[i][0]));
		m2 = min(m2, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][1] - l.sc) + abs(l.sc - line[i][0])));
		D[i][0] += m1;
		D[i][1] += m2;
	}
	cout << min(D[end][0], D[end][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};
struct node {
	ll fi, sc, th;
};
ll n, m, k, q,safe[DIM],dot[DIM][2],D[DIM][2];
node lb(ll x) {
	node res;
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos + 1 > q)res.th = INF;
	else res.th = safe[pos + 1];
	if (pos > q)res.sc = INF;
	else res.sc = safe[pos];
	if (pos - 1 < 1)res.fi = INF;
	else res.fi = safe[pos - 1];
	return res;
}
int main() {
	cin >> n >> m >> k >> q;
	ll to = 0;
	for (ll i = 1; i < DIM; i++) {
		dot[i][0] = INF;
		dot[i][1] = -1;
	}
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		dot[x][0] = min(dot[x][0], y);
		dot[x][1] = max(dot[x][1], y);
		to = max(x,to);
	}

	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	ll left = 1, right = 1;
	dot[0][0] = 1;
	dot[0][1] = 1;
	D[0][0] = -1;
	D[0][1] = -1;
	D[1][0] = dot[1][0]-1+abs(dot[1][0] - dot[1][1])*2;
	D[1][1] = dot[1][0]-1+abs(dot[1][0] - dot[1][1]) ;
	for (ll i = 2; i <= to; i++) {
		if (dot[i][1] == -1) {
			dot[i][0] = dot[i - 1][0];
			dot[i][1] = dot[i - 1][1];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}

		node l = lb(dot[i][0]), r = lb(dot[i][1]);
		D[i][0] = abs(dot[i][0] - dot[i][1]);
		D[i][1] = abs(dot[i][0] - dot[i][1]);
		D[i][0] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0]-r.fi)+abs(dot[i][1]-r.fi),abs(dot[i-1][0]-r.th)+abs(dot[i][1]-r.th)),abs(dot[i-1][0]-r.sc)+abs(dot[i][1]-r.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - r.fi) + abs(dot[i][1] - r.fi), abs(dot[i - 1][1] - r.th) + abs(dot[i][1] - r.th)), abs(dot[i - 1][1] - r.sc) + abs(dot[i][1] - r.sc)) + 1);
		D[i][1] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][0] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][0] - l.sc) + abs(dot[0][1] - l.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][1] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][1] - l.sc) + abs(dot[i][0] - l.sc)) + 1);

	}
	cout << min(D[to][0], D[to][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};

ll n, m, k, q, line[DIM][2], safe[DIM], D[DIM][2];
ll lo(ll x) {
	auto it = upper_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	pos--;
	if (pos > 0)return safe[pos];
	else return safe[pos+1];
}
ll up(ll x) {
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos <= q)return safe[pos];
	else return safe[pos - 1];
}
int main() {
	cin >> n >> m >> k >> q;
	for (ll i = 0; i < DIM; i++) {
		line[i][0] = INF;
		line[i][1] = -1;
	}
	ll end = -1;
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		line[x][0] = min(line[x][0], y);
		line[x][1] = max(line[x][1], y);
		end = max(end, x);
	}

	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	if (line[1][1] == -1) {
		line[1][1] = 1;
		line[1][0] = 1;
	}
	D[1][0] = line[1][1] - 1 + line[1][1] - line[1][0];
	D[1][1] = line[1][1] - 1;

	for (ll i = 2; i <= end; i++) {
		if (line[i][1] == -1) {
			line[i][1] = line[i - 1][1];
			line[i][0] = line[i - 1][0];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}
		D[i][0] = line[i][1] - line[i][0];
		D[i][1] = D[i][0];
		pp r = { lo(line[i][1]),up(line[i][1]) }, l = { lo(line[i][0]),up(line[i][0]) };
		ll m1, m2;
		m1 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][0] - r.sc) + abs(r.sc - line[i][1]));
		m1 = min(m1, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - r.fi) + abs(r.fi - line[i][1]), abs(line[i - 1][1] - r.sc) + abs(line[i][1] - r.sc)));
		m2 = D[i - 1][0] + 1 + min(abs(line[i - 1][0] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][0] - l.sc) + abs(l.sc - line[i][0]));
		m2 = min(m2, D[i - 1][1] + 1 + min(abs(line[i - 1][1] - l.fi) + abs(l.fi - line[i][0]), abs(line[i - 1][1] - l.sc) + abs(l.sc - line[i][0])));
		D[i][0] += m1;
		D[i][1] += m2;
	}
	cout << min(D[end][0], D[end][1]) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define po(x) (1<<x)
#define schnell ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 1;i<=n;i++)
typedef long long ll;
typedef long double ld;
#define DIM 200007
#define DIM2 10007
#define MODULO 998244353
#define MAXN 1000000
const long long INF = 10E16;
const ll mask = po(9) - 1;
const ll base = 100000000000;
struct pp {
	ll fi, sc;
	bool operator < (const pp& b)const {
		if (fi == b.fi)return sc < b.sc;
		return fi < b.fi;
	}
	bool operator > (const pp& b)const {
		if (fi == b.fi)return sc > b.sc;
		return fi > b.fi;
	}
	bool operator == (const pp& b)const {
		if (fi == b.fi && sc == b.sc)return 1;
		return 0;
	}
};
struct node {
	ll fi, sc, th;
};
ll n, m, k, q, safe[DIM], dot[DIM][2], D[DIM][2];
node lb(ll x) {
	node res;
	auto it = lower_bound(safe + 1, safe + 1 + q, x);
	ll pos = it - safe;
	if (pos + 1 > q)res.th = INF;
	else res.th = safe[pos + 1];
	if (pos > q)res.sc = INF;
	else res.sc = safe[pos];
	if (pos - 1 < 1)res.fi = INF;
	else res.fi = safe[pos - 1];
	return res;
}
int main() {
	cin >> n >> m >> k >> q;
	ll to = 0;
	for (ll i = 1; i < DIM; i++) {
		dot[i][0] = INF;
		dot[i][1] = -1;
	}
	forn(i, k) {
		ll x, y;
		cin >> x >> y;
		dot[x][0] = min(dot[x][0], y);
		dot[x][1] = max(dot[x][1], y);
		to = max(x, to);
	}

	forn(i, q)cin >> safe[i];
	sort(safe + 1, safe + 1 + q);
	ll left = 1, right = 1;
	if (dot[1][1] == -1) {
		dot[1][1] = 1;
		dot[0][0] = 1;
	}
	D[1][0] = dot[1][0] - 1 + abs(dot[1][0] - dot[1][1]) * 2;
	D[1][1] = dot[1][0] - 1 + abs(dot[1][0] - dot[1][1]);
	for (ll i = 2; i <= to; i++) {
		if (dot[i][1] == -1) {
			dot[i][0] = dot[i - 1][0];
			dot[i][1] = dot[i - 1][1];
			D[i][0] = D[i - 1][0] + 1;
			D[i][1] = D[i - 1][1] + 1;
			continue;
		}

		node l = lb(dot[i][0]), r = lb(dot[i][1]);
		D[i][0] = abs(dot[i][0] - dot[i][1]);
		D[i][1] = abs(dot[i][0] - dot[i][1]);
		D[i][0] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0] - r.fi) + abs(dot[i][1] - r.fi), abs(dot[i - 1][0] - r.th) + abs(dot[i][1] - r.th)), abs(dot[i - 1][0] - r.sc) + abs(dot[i][1] - r.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - r.fi) + abs(dot[i][1] - r.fi), abs(dot[i - 1][1] - r.th) + abs(dot[i][1] - r.th)), abs(dot[i - 1][1] - r.sc) + abs(dot[i][1] - r.sc)) + 1);
		D[i][1] += min(D[i - 1][0] + min(min(abs(dot[i - 1][0] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][0] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][0] - l.sc) + abs(dot[i][0] - l.sc)) + 1,
			D[i - 1][1] + min(min(abs(dot[i - 1][1] - l.fi) + abs(dot[i][0] - l.fi), abs(dot[i - 1][1] - l.th) + abs(dot[i][0] - l.th)), abs(dot[i - 1][1] - l.sc) + abs(dot[i][0] - l.sc)) + 1);

	}
	cout << min(D[to][0], D[to][1]) << endl;
	return 0;
}