#include <bits/stdc++.h>
using namespace std;
long long n, m, p, k, a[1000101], h[1000101];
struct dat {
  long long h, id;
};
bool operator<(dat x, dat y) { return x.h / a[x.id] > y.h / a[y.id]; }
bool check(long long h0) {
  priority_queue<dat> q;
  for (long long i = 1; i <= n; i++) {
    if (h0 - a[i] * m < h[i]) q.push((dat){h0, i});
  }
  long long flag = 0, tot = 0;
  for (long long i = 1; i <= m; i++) {
    for (long long j = 1; j <= k; j++) {
      if (q.empty()) return 1;
      dat x = q.top();
      q.pop();
      if (x.h < i * a[x.id]) return 0;
      if (x.h + p < h[x.id] + m * a[x.id]) {
        q.push((dat){x.h + p, x.id});
      }
    }
  }
  return q.empty();
}
signed main() {
  long long mx = -1;
  scanf("%lld%lld%lld%lld", &n, &m, &k, &p);
  for (long long i = 1; i <= n; i++)
    scanf("%lld%lld", &h[i], &a[i]), mx = max(mx, h[i] + m * a[i]);
  long long l = 1, r = mx, mid;
  while (l < r) {
    mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%lld\n", r);
}
