#include <bits/stdc++.h>
using namespace std;
int n, m, k, p;
int h[(100100)], a[(100100)];
long long val[(100100)];
int cnt[(100100)];
bool Judge(long long x) {
  int tot = 0;
  for (int i = 1; i <= n; ++i) val[i] = x;
  for (int i = 0; i <= m; ++i) cnt[i] = 0;
  for (int i = 1; i <= n; ++i) {
    int j = 0;
    while (j + val[i] / a[i] < m) {
      j += val[i] / a[i];
      val[i] %= a[i];
      val[i] += p;
      cnt[j]++;
      tot++;
      if (tot > m * k) return 0;
    }
    val[i] -= (long long)(m - j) * a[i];
    while (val[i] < h[i]) {
      val[i] += p;
      cnt[m]++;
      tot++;
      if (tot > m * k) return 0;
    }
  }
  for (int i = 1; i <= m; ++i) cnt[i] += cnt[i - 1];
  for (int i = 0; i <= m; ++i)
    if (cnt[i] > i * k) return 0;
  return 1;
}
int main() {
  cin >> n >> m >> k >> p;
  for (int i = 1; i <= n; ++i) scanf("%d%d", h + i, a + i);
  long long l = 0, r = 1LL << 45;
  while (l != r - 1) {
    long long mid = (l + r) >> 1;
    if (Judge(mid))
      r = mid;
    else
      l = mid;
  }
  cout << r << endl;
  return 0;
}
