#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const long long inf = 1e13;
int n, m;
long long k, p;
int h[N], g[N];
long long l[N];
long long cnt[5005];
bool check(long long mid) {
  memset(cnt, 0, sizeof(cnt));
  long long totk = k * m;
  long long cntt = 0;
  for (int i = 1; i <= n; i++) {
    long long nowh = mid;
    long long mm = m;
    for (mm = m; mm > 0;) {
      if (nowh / g[i] == 0) return false;
      long long newh = nowh % g[i];
      long long nowday = mm - nowh / g[i] + 1;
      long long toreach;
      bool flag = false;
      if (nowday <= 1) {
        newh += (1 - nowday) * g[i];
        nowday = 1;
        toreach = h[i];
        flag = true;
      } else {
        toreach = g[i];
        mm = nowday - 1;
      }
      long long times = (max(0LL, (toreach - newh)) + p - 1) / p;
      cnt[nowday] += times;
      cntt += times;
      nowh = newh + p * times;
      if (cntt > totk) return false;
      if (flag) break;
    }
  }
  long long sum = 0;
  for (long long i = m; i >= 1; i--) {
    sum += cnt[i];
    if (sum > k * (m - i + 1)) return false;
  }
  return true;
}
int main() {
  cin >> n >> m >> k >> p;
  for (int i = 1; i <= n; i++) scanf("%d %d", &h[i], &g[i]);
  long long l = 1, r = inf, mid, ans;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
