#include <bits/stdc++.h>
using namespace std;
int n, m, k;
long long a[100005], b[100005], h[100005], p;
struct Node {
  int id;
  long long val;
  Node() {}
  Node(int id = 0, long long val = 0) : id(id), val(val) {}
  bool operator<(const Node &a) const { return val / b[id] > a.val / b[a.id]; }
};
priority_queue<Node> q;
bool check(long long x) {
  long long tim = 0;
  while (!q.empty()) q.pop();
  for (int i = 1; i <= n; ++i) {
    h[i] = x;
    if (h[i] - m * b[i] < 0) q.push(Node(i, h[i]));
  }
  for (int i = 1; i <= m; ++i) {
    if (!q.empty() && h[q.top().id] - i * b[q.top().id] < 0) return false;
    for (int j = 1; j <= k; ++j) {
      if (q.empty()) break;
      int id = q.top().id;
      q.pop();
      h[id] += p;
      ++tim;
      if (h[id] - m * b[id] < 0) q.push(Node(id, h[id]));
    }
  }
  for (int i = 1; i <= n; ++i)
    if (h[i] - m * b[i] < a[i]) tim += (a[i] - h[i] + m * b[i] + p - 1) / p;
  return (tim <= k * m);
}
int main() {
  scanf("%d%d%d%lld", &n, &m, &k, &p);
  for (int i = 1; i <= n; ++i) scanf("%lld%lld", a + i, b + i);
  long long l = 0, r = 1e15, ans = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
