#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = 100005;
int h[N], a[N], need[N];
int n, m, k, p;
bool check(long long aim) {
  int rem = k * m;
  for (int i = (1); i <= (m); i++) need[i] = 0;
  for (int i = (1); i <= (n); i++) {
    long long now = aim, cnt = 0;
    int day = m + 1;
    while (day >= 2) {
      int t = min((long long)day - 1, now / a[i]);
      now -= (long long)t * a[i], day -= t;
      while (day >= 2 && now < a[i]) {
        if (!(rem--)) return 0;
        now += p, need[day]++, cnt++;
      }
    }
    while (now < h[i]) {
      if (!(rem--)) return 0;
      now += p, need[day]++, cnt++;
    }
  }
  int total = 0;
  for (int i = (1); i <= (m); i++) {
    total += need[i];
    total = max(0, total - k);
  }
  return !total;
}
int main() {
  read(n), read(m);
  read(k), read(p);
  long long l = 0, r = 1e15, mid;
  for (int i = (1); i <= (n); i++) {
    read(h[i]), read(a[i]);
    l = max(l, (long long)a[i]);
  }
  while (l < r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  cout << l << endl;
  return 0;
}
