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


int main() {
  
  int a, b, x, y;
  cin >> a >> b >> x >> y;

  int ans = 0;
  
  if (a == b) {
    ans = x;
  } else if (a < b) {
    if (y < 2 * x) {
      ans = (b - a) * y + x;
    } else {
      ans = (b - a) * 2 * x + x;
    }
  } else {
    if (y < 2 * x) {
      ans = (a - b - 1) * y + x;
    } else {
      ans = (a - b - 1) * 2 * x + x;
    }
  }

  cout << ans << endl;

  return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,j,n) for (int i=j; i < (int)(n); i++)
int h[200010];
int w[200010];

int main() {
	int n,a,b,m,jj,jj2;
	long long p,q,ans;

	p=1e15;
	ans=1e15;
	cin >> n >> m ;
	rep(i, n) cin >> h[i];
	rep(i, m) cin >> w[i];
	sort(h, h+n); //h[0:n] を値が小さい順にソート
	sort(w, w+m); //w[0:m] を値が小さい順にソート
	p=0;
	rep(i,n){
		if (i%2>0) p-=h[i];//奇数はマイナス
		else p+=h[i];//偶数はプラス
	}
	q=p;
	jj=0;
	rep(j,m){
		if (w[j]<h[0]) ans=min(ans,p-w[j]);
		else if (w[j]>h[n-1]) ans=min(ans,w[j]-p);
		else {
			rep2(i,jj,n){
				if (w[j]<h[i]) break;
				if (i%2>0) q=q+h[i]+h[i];
				else q=q-h[i]-h[i];
				jj++;
			}
			if (jj%2>0) ans=min(ans,q+w[j]);
			else ans=min(ans,q-w[j]);
		}
	}
	cout << ans << endl;
	return 0;
}