#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void ckmin(T &a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
void ckmax(T &a, U b) {
  if (a < b) a = b;
}
int N, M, K;
long long P;
pair<long long, long long> arr[100013], num[100013];
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
bool check(long long x) {
  while (!pq.empty()) pq.pop();
  for (auto i = (0); i < (N); i++) {
    if (x < arr[i].second) return false;
    num[i] = {x, 0};
    pq.push({x / arr[i].second, i});
  }
  long long strikes = 0;
  for (auto i = (1); i < (M); i++) {
    strikes += K;
    while (true) {
      pair<long long, long long> p = pq.top();
      if (p.first > i) break;
      pq.pop();
      int ind = p.second;
      num[ind].first -= arr[ind].second * (i - num[ind].second);
      assert(num[ind].first < arr[ind].second);
      long long need = (arr[ind].second - num[ind].first + P - 1) / P;
      strikes -= need;
      num[ind].first += need * P;
      num[ind].second = i;
      pq.push({(num[ind].first / arr[ind].second) + i, ind});
    }
    if (strikes < 0) return false;
  }
  strikes += K;
  for (auto i = (0); i < (N); i++) {
    num[i].first -= arr[i].second * (M - num[i].second);
    if (num[i].first >= arr[i].first) continue;
    strikes -= (arr[i].first - num[i].first + P - 1) / P;
  }
  return (strikes >= 0);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M >> K >> P;
  for (auto i = (0); i < (N); i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  long long lo = 0, hi = 113000000000000;
  while (hi > lo) {
    long long mid = (lo + hi) >> 1;
    if (check(mid))
      hi = mid;
    else
      lo = mid + 1;
  }
  cout << lo << '\n';
  return 0;
}
