#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100005;
long long n, m, k, p, L, R;
long long a[maxn], h[maxn], hgt[maxn];
struct bamboo {
  long long day, id;
  inline bool operator<(bamboo x) const { return day > x.day; }
};
priority_queue<bamboo> q;
long long check(long long mid) {
  while (!q.empty()) q.pop();
  for (long long i = 1; i <= n; i++) {
    hgt[i] = mid;
    if (hgt[i] - m * a[i] < h[i]) q.push(bamboo{hgt[i] / a[i], i});
  }
  for (long long i = 1; i <= m; i++)
    for (long long j = 1; j <= k; j++) {
      if (q.empty()) return 1;
      bamboo now = q.top();
      long long x = now.id;
      q.pop();
      if (now.day < i) return 0;
      hgt[x] += p, now.day = hgt[x] / a[x];
      if (hgt[x] - m * a[x] < h[x]) q.push(now);
    }
  return q.empty();
}
signed main() {
  scanf("%lld%lld%lld%lld", &n, &m, &k, &p);
  for (long long i = 1; i <= n; i++) scanf("%lld%lld", &h[i], &a[i]);
  L = 0, R = 100000000000000000;
  while (L + 1 < R) {
    long long mid = (L + R) >> 1;
    if (check(mid))
      R = mid;
    else
      L = mid;
  }
  printf("%lld\n", R);
  return 0;
}
