#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long SUM = 0, ff = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    SUM = (SUM << 3) + (SUM << 1) + (ch ^ 48);
    ch = getchar();
  }
  return SUM * ff;
}
const int N = 100010;
long long high[N], add[N];
long long n, m, k, p;
struct node {
  long long day;
  int id;
  inline friend bool operator<(node a1, node a2) { return a1.day > a2.day; }
};
int grow[N];
inline bool check(long long x) {
  priority_queue<node> pq;
  memset(grow, 0, sizeof(grow));
  for (int i = 1; i <= n; i++)
    if (x - add[i] * m < high[i]) pq.push((node){x / add[i], i});
  for (int i = 1; i <= m && !pq.empty(); i++)
    for (int j = 1; j <= k && !pq.empty(); j++) {
      node top = pq.top();
      pq.pop();
      if (top.day < i) return 0;
      grow[top.id]++;
      if (x + grow[top.id] * p - add[top.id] * m < high[top.id])
        pq.push((node){(x + grow[top.id] * p) / add[top.id], top.id});
    }
  return pq.empty();
}
int main() {
  long long l = 0, r = 0, res;
  n = read(), m = read(), k = read(), p = read();
  for (int i = 1; i <= n; i++) {
    high[i] = read(), add[i] = read();
    r = max(r, high[i] + add[i] * m);
  }
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid)) {
      r = mid - 1;
      res = mid;
    } else {
      l = mid + 1;
    }
  }
  printf("%lld\n", res);
  return 0;
}
