#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') X = X * 10 + c - '0', c = getchar();
  return X * w;
}
const int N = 100000 + 10;
int n, m, k, p, a[N], h[N], cnt[N];
struct node {
  long long d;
  int id;
};
bool operator<(node a, node b) { return a.d > b.d; }
priority_queue<node> Q;
inline int check(long long mid) {
  while (!Q.empty()) Q.pop();
  memset(cnt, 0, sizeof(cnt));
  for (register int i = 1; i <= n; ++i)
    if (mid - 1ll * m * a[i] < h[i]) Q.push((node){mid / a[i], i});
  for (register int i = 1; i <= m && !Q.empty(); ++i) {
    for (register int j = 1; j <= k && !Q.empty(); ++j) {
      node x = Q.top();
      Q.pop();
      if (x.d < i) return 0;
      ++cnt[x.id];
      if (mid - 1ll * m * a[x.id] + 1ll * p * cnt[x.id] < h[x.id])
        Q.push((node){(mid + 1ll * p * cnt[x.id]) / a[x.id], x.id});
    }
  }
  return Q.empty();
}
int main() {
  n = read(), m = read(), k = read(), p = read();
  for (register int i = 1; i <= n; ++i) h[i] = read(), a[i] = read();
  long long L = 1, R = 1e13;
  while (L < R) {
    long long mid = (L + R) >> 1;
    if (check(mid))
      R = mid;
    else
      L = mid + 1;
  }
  printf("%lld\n", L);
  return 0;
}
