#include <iostream>
#include <cmath>

using namespace::std;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int a, b, x, y;
	cin >> a >> b >> x >> y;
	int dif = a - b;
	int t = 0;
	if (dif > 0) {
		t += x;
		t += min(y, 2*x) * (dif - 1);
	}
	else if (dif < 0) {
		t += x;
		t += min(y, 2*x) * (-dif);
	}
	else {
		t += x;
	}
	cout << t;
	return 0;
}
#include <algorithm>
// #include <atcoder/all>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
constexpr double PI = 3.141592653589793;
constexpr int INF = 1e9 + 10;
constexpr ll INFL = 1e18 + 10;

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
void dump(const std::vector<T> &ar) {
  for (T e : ar) {
    std::cout << e << "\n";
  }
}

template <typename T>
void dump(const std::set<T> &s) {
  for (T e : s) {
    std::cout << e << " ";
  }
  std::cout << "\n";
}

using namespace std;
// using namespace atcoder;
// cout << setprecision(20) << ans << "\n";

template <typename T>
void print(T ans) {
  cout << ans << "\n";
}

template <>
void print(double ans) {
  cout << setprecision(20) << ans << "\n";
}

ll getDigit(ll x) { return log10(x) + 1; }

int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int a, b, x, y;
  cin >> a >> b >> x >> y;

  vector<int> atower(110, INF), btower(110, INF);
  if (a == b) {
    cout << x << "\n";
    return 0;
  }
  if (a > b) {
    atower[a] = 0;
    btower[a] = x;
    for (int i = a; i > b - 1; --i) {
      btower[i - 1] = min(atower[i] + x, btower[i] + y);
      atower[i - 1] = min(atower[i] + y, btower[i - 1] + x);
    }
    cout << btower[b] << "\n";
    return 0;
  }

  atower[a] = 0;
  btower[a] = x;
  for (int i = a; i < b + 1; i++) {
    atower[i + 1] = min(atower[i] + y, btower[i] + x);
    btower[i + 1] = min(atower[i + 1] + x, btower[i] + y);
  }
  cout << btower[b] << "\n";

  return 0;
}
