#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 100;
long long n, m, k, p, h[N], a[N];
struct node {
  long long h, cnt, last, id;
};
bool operator<(node a, node b) { return a.cnt > b.cnt; }
inline long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
inline bool check(long long mid) {
  priority_queue<node> q;
  for (long long i = 1; i <= n; i++) {
    if (mid - a[i] * m >= h[i]) continue;
    q.push((node){mid, (mid + a[i]) / a[i], 0, i});
  }
  for (long long i = 1; i <= m; i++) {
    vector<node> tmp;
    for (long long j = 1; j <= k; j++) {
      if (q.empty()) break;
      node x = q.top();
      q.pop();
      long long now = x.h - (i - x.last) * a[x.id];
      if (now < 0) return 0;
      x.h = now + p;
      x.last = i;
      if (x.h - a[x.id] * (m - i) >= h[x.id]) continue;
      x.cnt = i + (x.h + a[x.id]) / a[x.id];
      q.push(x);
    }
  }
  return q.empty();
}
signed main() {
  n = read();
  m = read();
  k = read();
  p = read();
  for (long long i = 1; i <= n; i++) h[i] = read(), a[i] = read();
  k = min(k, n);
  long long MAX = 0;
  for (long long i = 1; i <= n; i++) MAX = max(MAX, h[i] + m * a[i]);
  long long l = 0, r = MAX;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%lld\n", r);
}
