#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  x = 0;
  bool w = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') w = 0;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x = w ? x : -x;
}
const long long N = 1e5 + 10;
long long n, m, k, c[N], h[N], a[N], p, Max;
inline bool check(long long H) {
  priority_queue<pair<long long, long long> > q;
  long long use = 0;
  for (long long i = 1; i <= n; i++) {
    c[i] = 0;
    if (h[i] + a[i] * m <= H) continue;
    q.push(pair<long long, long long>(-(H / a[i]), i));
  }
  for (long long i = 1; q.size() && i <= m; i++) {
    for (long long j = 1; q.size() && j <= k; j++) {
      if (-q.top().first < i) return 0;
      long long x = q.top().second;
      q.pop();
      long long w = H + p * (++c[x]) / a[x];
      if (w < m) q.push(pair<long long, long long>(-w, x));
      ++use;
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long w = H - a[i] * m + c[i] * p;
    if (w >= h[i]) continue;
    w = (h[i] - w - 1) / p + 1;
    use += w;
    if (use > m * k) return 0;
  }
  return 1;
}
signed main() {
  read(n), read(m), read(k), read(p);
  for (long long i = 1; i <= n; i++)
    read(h[i]), read(a[i]), Max = max(Max, h[i] + a[i] * m);
  long long l, r, mid;
  l = 1, r = Max + 1;
  while (l < r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << r << endl;
  return 0;
}
