#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, K, p, h[N], a[N], f[N];
bool chk(long long mid) {
  memset(f, 0, sizeof(f));
  set<pair<long long, int> > S;
  for (int i = (1); i <= (n); ++i)
    if (mid - 1LL * a[i] * m < h[i]) S.insert({mid / a[i], i});
  for (int i = (1); i <= (m); ++i)
    for (int j = (1); j <= (K); ++j) {
      if (S.empty()) return 1;
      auto now = *S.begin();
      S.erase(S.begin());
      if (now.first < i) return 0;
      ++f[now.second];
      if (mid - 1LL * a[now.second] * m + 1LL * f[now.second] * p <
          h[now.second]) {
        S.insert({(mid + 1LL * f[now.second] * p) / a[now.second], now.second});
      }
    }
  return S.empty();
}
int main() {
  scanf("%d%d%d%d", &n, &m, &K, &p);
  for (int i = (1); i <= (n); ++i) {
    scanf("%d%d", &h[i], &a[i]);
  }
  long long l = 0, r = 1e13, ans = 0;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (chk(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  cout << ans << endl;
  return 0;
}
