#include <bits/stdc++.h>
using namespace std;
long long H[200000], A[200000];
bool check(int N, int M, int K, int P, long long h) {
  long long H2[N];
  for (int i = (0); i < (N); ++i) {
    H2[i] = h;
  }
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      Q;
  for (int i = (0); i < (N); ++i) {
    if (H2[i] - M * A[i] < 0) {
      Q.push(make_pair(H2[i] / A[i] - 1, i));
    }
  }
  long long beat = 0;
  for (; beat < M * K && !Q.empty(); ++beat) {
    pair<long long, long long> t = Q.top();
    Q.pop();
    if (t.first < beat / K) {
      return false;
    }
    int i = t.second;
    H2[i] += P;
    if (H2[i] - M * A[i] < 0) {
      Q.push(make_pair(H2[i] / A[i] - 1, i));
    }
  }
  if (beat > M * K) {
    return false;
  }
  for (int i = (0); i < (N); ++i) {
    if (H2[i] - M * A[i] < H[i]) {
      long long t = (H[i] + M * A[i] - H2[i] + P - 1) / P;
      beat += t;
      if (beat > M * K) {
        return false;
      }
    }
  }
  return true;
}
int main(int argc, char **argv) {
  long long N, M, K, P;
  cin >> N >> M >> K >> P;
  for (int i = (0); i < (N); ++i) {
    cin >> H[i] >> A[i];
  }
  long long lo = 0, hi = 1LL << 60;
  long long res = hi + 1;
  while (lo <= hi) {
    long long mi = (lo + hi) >> 1;
    if (check(N, M, K, P, mi)) {
      hi = mi - 1;
      res = min(res, mi);
    } else {
      lo = mi + 1;
    }
  }
  cout << res;
  return 0;
}
