usingnamespacestd; usingnamespace FAST_IO; const ll mod = 1e9 + 7; constint INF = 0x3f3f3f3f; const ll INF_LL = 0x3f3f3f3f3f3f3f3f; constdouble eps = 1e-5; constint maxn = 1e3 + 10; constint maxm = 1e5 + 10; int t, n, m, k; int x, y, z; map<int, int> mp; vector<int> a; vector<PII> b; int newa[maxn]; intfind(int k) { int l = 0, r = a.size() - 1; while (l <= r) { int mid = (l + r) >> 1; if (a[mid] == k) return mid; elseif (a[mid] > k) r = mid - 1; else l = mid + 1; } } intmain() { // #define COMP_DATA #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif ios::sync_with_stdio(false); cin.tie(0); cin >> n >> x >> y >> z; a.push_back(-INF); a.push_back(INF); for (int i = 1, l, r; i <= n; i++) { cin >> l >> r; a.push_back(l); a.push_back(r + 1); b.push_back({l, r}); } sort(a.begin(), a.end()); // 去重 a.erase(unique(a.begin(), a.end()), a.end());
for (auto &item : b) { int li = find(item.first); int ri = find(item.second + 1); newa[0] += x; newa[li] += y - x; newa[ri] += z - y; newa[a.size() - 1] -= z; }
int ans = 0; int tmp = 0; for (int i = 0; i < a.size(); i++) { tmp += newa[i]; ans = max(ans, tmp); } cout << ans << endl; return0; }