#include <bits/stdc++.h>
using namespace std;
const int L = 1 << 19;
char ibuf[L], *ie = ibuf + L, *ip = ie - 1;
inline char nc(void) {
  if (++ip == ie)
    if (fread(ip = ibuf, 1, L, stdin))
      ;
  return *ip;
}
inline int read(void) {
  char opt;
  int flag = 1, res = 0;
  while ((opt = nc()) < '0')
    if (opt == '-') flag = -1;
  while (opt >= '0') {
    res = (res << 3) + (res << 1) + opt - '0';
    opt = nc();
  }
  return res * flag;
}
int n, m, k, p, a[100001], h[100001], v[100001];
inline char Check(long long mid) {
  int i, j;
  long long res, sum = 0, tim;
  memset(v, 0, sizeof v);
  for (i = 1; i <= n; ++i) {
    tim = (mid - 1ll * a[i] * m >= h[i])
              ? 0
              : (h[i] + 1ll * a[i] * m - mid + p - 1) / p;
    if ((sum += tim) > m * k) return 0;
    for (j = 0; j < tim; ++j)
      if ((mid + 1ll * j * p) / a[i] < m) ++v[(mid + 1ll * j * p) / a[i]];
  }
  res = 0;
  for (i = 0; i < m; ++i) {
    res += v[i];
    if (res > i * k) return 0;
  }
  return 1;
}
signed main(void) {
  int i;
  long long l = 0, r = 0, mid, ans;
  n = read(), m = read(), k = read(), p = read();
  for (i = 1; i <= n; ++i)
    h[i] = read(), a[i] = read(), r = max(r, 1ll * m * a[i] + h[i]);
  while (l <= r)
    (Check(mid = (l + r) >> 1)) ? r = (ans = mid) - 1 : l = mid + 1;
  printf("%lld\n", ans);
  return 0;
}
