#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long llINF = 1e18;
const int MAXN = 1e5 + 5;
int n, m, k, p;
int h[MAXN], a[MAXN];
long long curH[MAXN];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    q;
bool Check(long long H) {
  while (!q.empty()) q.pop();
  for (int i = 1; i <= n; i++) {
    curH[i] = H;
    if (H - 1ll * m * a[i] < h[i]) q.push(make_pair(H / a[i], i));
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= k; j++) {
      if (q.empty()) return 1;
      pair<long long, int> cur = q.top();
      q.pop();
      if (cur.first < i) return 0;
      int id = cur.second;
      curH[id] += p;
      cur.first = curH[id] / a[id];
      if (curH[id] - 1ll * m * a[id] < h[id]) q.push(cur);
    }
  }
  return q.empty();
}
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 l = 0, r = llINF, res = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (Check(mid)) {
      res = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%lld\n", res);
  return 0;
}
