#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 5;
template <typename _T>
void read(_T &x) {
  x = 0;
  char s = getchar();
  long long f = 1;
  while (s < '0' || '9' < s) {
    f = 1;
    if (s == '-') f = -1;
    s = getchar();
  }
  while ('0' <= s && s <= '9') {
    x = (x << 3) + (x << 1) + (s - '0'), s = getchar();
  }
  x *= f;
}
template <typename _T>
void write(_T x) {
  if (x < 0) putchar('-'), x = -x;
  if (9 < x) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename _T>
_T MAX(const _T a, const _T b) {
  return a > b ? a : b;
}
template <typename _T>
_T MIN(const _T a, const _T b) {
  return a < b ? a : b;
}
queue<pair<long long, long long> > q[MAXN];
long long val[MAXN];
long long H[MAXN], A[MAXN];
long long N, M, K, P;
bool Chk(const long long len) {
  for (long long i = 1; i <= M; i++)
    while (!q[i].empty()) q[i].pop();
  for (long long i = 1; i <= N; i++) {
    long long t = len / A[i] + 1;
    if (t <= M) q[t].push(pair<long long, long long>(i, 0));
  }
  long long res = 0;
  for (long long i = 1; i <= M; i++, res += K)
    while (!q[i].empty()) {
      if (!res) return false;
      res--;
      pair<long long, long long> h = q[i].front();
      q[i].pop();
      h.second++;
      long long t = (1ll * h.second * P + len) / A[h.first] + 1;
      if (t <= M) q[t].push(h);
    }
  long long su = 0;
  for (long long i = 1; i <= N; i++)
    su += (MAX(1ll * M * A[i] + H[i] - len, 0ll) + P - 1) / P;
  return su <= M * K;
}
signed main() {
  long long l = 0, r = 0;
  read(N), read(M), read(K), read(P);
  for (long long i = 1; i <= N; i++) {
    read(H[i]), read(A[i]);
    l = MAX(l, (long long)A[i]), r = MAX(r, H[i] + 1ll * M * A[i]);
  }
  long long mid;
  while (l < r) {
    mid = l + r >> 1;
    if (Chk(mid))
      r = mid;
    else
      l = mid + 1;
  }
  write(l), putchar('\n');
  return 0;
}
