#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
int k, p;
int x[100000];
int y[100000];
long long z[100000];
set<pair<int, int> > all;
int can(long long h) {
  all.clear();
  for (int i = 0; i < n; i++) {
    z[i] = h;
    int tmp = -1;
    if (z[i] - (long long)m * y[i] < 0)
      tmp = z[i] / y[i];
    else if (z[i] - (long long)m * y[i] < x[i])
      tmp = m;
    if (tmp != -1) all.insert(make_pair(tmp, i));
  }
  for (int i = 0; i < m && !all.empty(); i++)
    for (int j = 0; j < k && !all.empty(); j++) {
      pair<int, int> cur = *all.begin();
      all.erase(all.begin());
      if (cur.first <= i) return 0;
      z[cur.second] += p;
      int tmp = -1;
      if (z[cur.second] - (long long)m * y[cur.second] < 0)
        tmp = (z[cur.second] + y[cur.second] - 1) / y[cur.second];
      else if (z[cur.second] - (long long)m * y[cur.second] < x[cur.second])
        tmp = m;
      if (tmp != -1) all.insert(make_pair(tmp, cur.second));
    }
  return int(all.empty());
}
int main() {
  scanf("%d%d%d%d", &n, &m, &k, &p);
  for (int i = 0; i < n; i++) scanf("%d%d", &x[i], &y[i]);
  long long l = -1, r = 1e18;
  while (r - l > 1) {
    long long s = (l + r) / 2;
    if (can(s))
      r = s;
    else
      l = s;
  }
  cout << r << endl;
  return 0;
}
