#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const long long int maxn = 1e5 + 16, md = 1e9 + 7, inf = 2e18;
long long int tav(long long int n, long long int k) {
  long long int res = 1;
  while (k > 0) {
    if (k & 1) {
      res *= n;
      res %= md;
    }
    n *= n;
    n %= md;
    k >>= 1;
  }
  return res;
}
long long int n, m, k, p;
long long int a[maxn], h[maxn];
vector<long long int> v;
bool check(long long int x) {
  v.clear();
  long long int cnt = 0, mk = m * k;
  for (long long int i = 0; i < n; i++) {
    long long int o = h[i] + 1ll * m * a[i], c = x;
    while (c < o) {
      long long int u = min(m, c / a[i]);
      c += p;
      cnt++;
      if (cnt > mk) return false;
      v.push_back(u);
    }
  }
  v.push_back(inf);
  sort(v.begin(), v.end());
  if (!v[0]) return false;
  cnt = 0;
  for (long long int i = 1; i < m; i++) {
    while (v[cnt] == i) cnt++;
    if (cnt > i * k) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k >> p;
  long long int y = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> h[i] >> a[i];
    y = max(y, a[i]);
  }
  long long int l = 0, r = inf;
  while (l < r - 1) {
    long long int m = (r + l) >> 1;
    if (check(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << l + 1 << '\n';
  return 0;
}
