#include <bits/stdc++.h>
int read() {
  int r = 0, t = 1, c = getchar();
  while (c < '0' || c > '9') {
    t = c == '-' ? -1 : 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    r = (r << 3) + (r << 1) + (c ^ 48);
    c = getchar();
  }
  return r * t;
}
const int N = 100010;
int n, m, k;
long long h[N], a[N], p;
struct bamboo {
  long long h, id;
  bamboo(long long H = 0, long long I = 0) {
    h = H;
    id = I;
  }
};
int operator<(bamboo x, bamboo y) { return x.h / a[x.id] > y.h / a[y.id]; }
std::priority_queue<bamboo> q;
int check(long long H) {
  while (!q.empty()) q.pop();
  for (int i = (1), end_i = (n); i <= end_i; i++)
    if (H - a[i] * m < h[i]) q.push(bamboo(H, i));
  if (q.empty()) return 1;
  for (int i = (1), end_i = (m); i <= end_i; i++) {
    bamboo t = q.top();
    if (t.h - i * a[t.id] < 0) return 0;
    for (int j = (1), end_j = (k); j <= end_j; j++) {
      bamboo t = q.top();
      q.pop();
      t.h += p;
      if (t.h - a[t.id] * m < h[t.id]) q.push(t);
      if (q.empty()) return 1;
    }
  }
  return 0;
}
int main() {
  n = read();
  m = read();
  k = read();
  p = read();
  for (int i = (1), end_i = (n); i <= end_i; i++) {
    h[i] = read();
    a[i] = read();
  }
  long long l = 0, r = 1ll << 60;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%I64d\n", r);
  return 0;
}
