#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
const bool db = false;
long long a[100010], h[100010];
long long ch[100010], p;
int n, m, k;
bool ok(long long x) {
  for (int i = 0; i < n; ++i) ch[i] = x;
  set<pair<long long, int> > st;
  for (int i = 0; i < n; ++i)
    if (x - m * a[i] < 0) st.insert(make_pair(x / a[i] - 1, i));
  long long tot = 0;
  while (tot < m * k) {
    if (st.empty()) break;
    long long val = st.begin()->first;
    int id = st.begin()->second;
    st.erase(st.begin());
    if (val < tot / k) return false;
    ch[id] += p;
    if (ch[id] - m * a[id] < 0) st.insert(make_pair(ch[id] / a[id] - 1, id));
    ++tot;
  }
  if (!st.empty()) return false;
  for (int i = 0; i < n; ++i) {
    if (ch[i] - m * a[i] < h[i]) {
      tot += (h[i] - (ch[i] - m * a[i]) + p - 1) / p;
    }
  }
  return tot <= m * k;
}
int main() {
  scanf("%d%d%d%lld", &n, &m, &k, &p);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", &h[i], &a[i]);
  }
  long long l = 0, r = 1LL << 55;
  while (l < r - 1) {
    long long m = (l + r) / 2;
    if (ok(m))
      r = m;
    else
      l = m;
  }
  cout << r << "\n";
  getchar();
  getchar();
  return 0;
}
