#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
struct bamboo {
  long long d, cur;
  int id;
};
struct compBamboo {
  bool operator()(const bamboo &l, const bamboo &r) {
    if (l.d > r.d) return true;
    if (l.d < r.d) return false;
    if (l.cur > r.cur) return true;
    if (l.cur < r.cur) return false;
    if (l.id > r.id) return true;
    return false;
  }
};
int n, m, k, p, a[100005], h[100005];
bool Check(long long st) {
  priority_queue<bamboo, vector<bamboo>, compBamboo> s;
  for (int i = (1); i <= (n); ++i) {
    long long x = (a[i] != 0) ? (st / a[i]) : 1000000000000000007LL;
    s.push({x, st, i});
  }
  long long hammerLeft = m * k;
  for (int i = (1); i <= (m); ++i) {
    for (int j = (1); j <= (k); ++j) {
      long long d = s.top().d, cur = s.top().cur;
      int id = s.top().id;
      if (d >= m) break;
      if (d < i) return false;
      s.pop();
      long long x = (a[id] != 0) ? ((cur + p) / a[id]) : 1000000000000000007LL;
      s.push({x, cur + p, id});
      --hammerLeft;
    }
  }
  while (!s.empty()) {
    long long cur = s.top().cur;
    int id = s.top().id;
    if (cur - 1LL * a[id] * m < h[id])
      hammerLeft -= (h[id] - (cur - 1LL * a[id] * m) + p - 1) / p;
    s.pop();
  }
  return (hammerLeft >= 0);
}
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (int i = (1); i <= (n); ++i) scanf("%d%d", &h[i], &a[i]);
  long long lo = 0, hi = 0, res = 1000000000000000007LL;
  for (int i = (1); i <= (n); ++i) {
    lo = max(lo, 1LL * a[i]);
    hi = max(hi, h[i] + 1LL * a[i] * m);
  }
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (Check(mid)) {
      res = mid;
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  printf("%lld", res);
  return 0;
}
