#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define forn(i,n) for(int i = 0; i < (int) n; i++)
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

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

  if (a == b) {
    cout << x << "\n";
    return 0;
  }

  int stair = min(y, 2 * x);
  if (a < b) cout << (b - a) * stair + x << "\n";
  else cout << (a - b - 1) * stair + x << "\n";
}

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

using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main(){
	int n; cin>>n;
	ll ans = 0;
	rep(i,n){
		ll a,b; cin>>a>>b;
		ans += (b-a+1) * (b+a)/2;
	}
	cout << ans << endl;
}