#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct node {
  int now;
  long long ret;
  bool operator<(const node &x) const { return x.ret < ret; }
};
int n, m, k;
long long h[N], a[N], l, r, ans, p, dis[N];
bool check(long long x) {
  priority_queue<node> q;
  for (int i = 1; i <= n; ++i) dis[i] = x;
  for (int i = 1; i <= n; ++i) {
    if ((dis[i] - a[i] * m) < h[i]) {
      q.push((node){i, (x / a[i])});
    }
  }
  for (int i = 1; i <= m; ++i) {
    for (int j = 1; j <= k; ++j) {
      if (!q.size()) return 1;
      node st = q.top();
      q.pop();
      int now = st.now;
      long long d = st.ret;
      if (d < i) return 0;
      dis[now] += p;
      if ((dis[now] - a[now] * m) < h[now]) {
        q.push((node){now, dis[now] / a[now]});
      }
    }
  }
  return q.empty();
}
int main() {
  scanf("%d%d%d%lld", &n, &m, &k, &p);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld%lld", &h[i], &a[i]);
    r = max(r, h[i] + 1ll * a[i] * m);
  }
  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;
}
