#include <bits/stdc++.h>
using namespace std;
int n, m, k, p, h[100000 + 5], a[100000 + 5];
vector<int> V[100000 + 5];
vector<int>::iterator it;
long long s[100000 + 5];
inline bool Check(const long long& x) {
  register int i;
  for (i = 0; i ^ m; ++i) V[i].clear();
  for (i = 1; i <= n; ++i)
    ((s[i] = x) / a[i]) < m && (V[(s[i] = x) / a[i]].push_back(i), 0);
  register int t = 0;
  long long d;
  for (i = 0; i ^ m; ++i)
    for (it = V[i].begin(); it != V[i].end(); ++it) {
      d = (1LL * a[*it] * (i + 1) - s[*it] + p - 1) / p;
      if (s[*it] += d * p, (t += d) > i * k) return false;
      (s[*it] / a[*it]) < m && (V[s[*it] / a[*it]].push_back(*it), 0);
    }
  for (i = 1; i <= n; ++i)
    if (s[i] < 1LL * a[i] * m + h[i])
      if (d = (1LL * a[i] * m + h[i] - s[i] + p - 1) / p, (t += d) > m * k)
        return false;
  return true;
}
int main() {
  register int i;
  for (scanf("%d%d%d%d", &n, &m, &k, &p), i = 1; i <= n; ++i)
    scanf("%d%d", h + i, a + i);
  long long l = 0, r = 1e13, mid;
  while (l ^ r) Check(mid = l + r >> 1) ? r = mid : l = mid + 1;
  return printf("%lld\n", r), 0;
}
