#include <bits/stdc++.h>
using namespace std;
const int maxn = 101000;
int n, k, p, a[maxn], h[maxn];
long long m, now[maxn], ned[maxn];
void init() {
  for (int i = (1); i <= (n); ++i) scanf("%d%d", &h[i], &a[i]);
  for (int i = (1); i <= (n); ++i) ned[i] = m * a[i];
}
int ok(long long mid) {
  priority_queue<pair<long long, long long> > q;
  long long sum = k * m, id;
  for (int i = (1); i <= (n); ++i) {
    now[i] = mid;
    if (mid < ned[i]) q.push(make_pair(-(mid / a[i] + 1), i));
  }
  for (int i = (1); i <= (m * k); ++i)
    if (!q.empty()) {
      if ((i + k - 1) / k >= -q.top().first) return 0;
      id = q.top().second;
      now[id] += p;
      sum--;
      q.pop();
      if (now[id] < ned[id]) q.push(make_pair(-(now[id] / a[id] + 1), id));
    }
  for (int i = (1); i <= (n); ++i) {
    now[i] -= ned[i];
    if (now[i] < h[i]) sum -= (h[i] - now[i] + p - 1) / p;
    if (sum < 0) return 0;
  }
  return 1;
}
void work() {
  long long l = 0, r = ((1e9) * (1e9)), mid;
  while (l < r) {
    mid = (l + r) >> 1;
    if (ok(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << endl;
}
int main() {
  while (cin >> n >> m >> k >> p) {
    init();
    work();
  }
  return 0;
}
