#include <bits/stdc++.h>
inline void in(int &MAGNUS) { scanf("%d", &MAGNUS); }
inline void out(int MAGNUS) { printf("%d\n", MAGNUS); }
inline void in(int &MAGNUS, int &CLAR) { scanf("%d%d", &MAGNUS, &CLAR); }
inline void out(int MAGNUS, int CLAR) { printf("%d %d\n", MAGNUS, CLAR); }
inline void inl(long long &LIV) { scanf("%lld", &LIV); }
inline void inl(long long &LIV, long long &MART) {
  scanf("%lld%lld", &LIV, &MART);
}
inline void outl(long long LIV) { printf("%lld\n", LIV); }
inline void outl(long long LIV, long long MART) {
  printf("%lld %lld\n", LIV, MART);
}
using namespace std;
long long N, M, K;
long long P, a[100005], h[100005], hx[100005];
bool ok(long long hmax) {
  for (int i = 1; i <= N; i++) hx[i] = hmax;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  for (int i = 1; i <= N; i++) {
    if (hx[i] - M * a[i] >= 0) continue;
    q.push(make_pair(hx[i] / a[i] - 1, i));
  }
  long long cut = 0;
  for (; cut < K * M && !q.empty(); cut++) {
    if (q.empty()) break;
    pair<long long, long long> now = q.top();
    q.pop();
    long long hitneed = now.first;
    if (hitneed < cut / K) return 0;
    int idx = now.second;
    hx[idx] += P;
    if (hx[idx] - M * a[idx] >= 0) continue;
    q.push(make_pair(hx[idx] / a[idx] - 1, idx));
  }
  for (int i = 1; i <= N; i++) {
    if (hx[i] - M * a[i] >= h[i]) continue;
    cut += (h[i] - (hx[i] - M * a[i]) + P - 1) / P;
    if (cut > M * K) return 0;
  }
  return 1;
}
int main() {
  inl(N, M);
  inl(K, P);
  for (int i = 1; i <= N; i++) inl(h[i], a[i]);
  long long lo = 0, hi = 2e14, ans = -1;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (ok(mid)) {
      ans = mid;
      hi = mid - 1;
    } else
      lo = mid + 1;
  }
  outl(ans);
  return 0;
}
