#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 1e5 + 5, MAX_M = 5e3 + 15,
                inf = 1000000000LL * 1000000000LL + 1;
long long n, m, k, p;
long long a[MAX_N], h[MAX_N];
long long arr[MAX_N];
long long cnt[MAX_M];
bool can(long long d) {
  for (long long i = 0; i < n; i++) arr[i] = d;
  long long ans = 0;
  memset(cnt, 0, sizeof cnt);
  for (long long i = 0; i < n; i++) {
    while (arr[i] - a[i] * m < 0) {
      cnt[(arr[i] + a[i]) / a[i] - 1]++;
      arr[i] += p;
      ans++;
      if (m * k < ans) return false;
    }
    while (arr[i] - a[i] * m < h[i]) {
      cnt[m]++;
      arr[i] += p;
      ans++;
      if (m * k < ans) return false;
    }
  }
  for (long long i = 0; i <= m; i++) {
    cnt[i] += (i ? cnt[i - 1] : 0);
    if (i * k < cnt[i]) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m >> k >> p;
  for (long long i = 0; i < n; i++) cin >> h[i] >> a[i];
  long long s = 0, e = inf;
  while (e - s > 1) {
    long long med = e + s >> 1;
    if (can(med))
      e = med;
    else
      s = med;
  }
  cout << e << "\n";
  return 0;
}
