#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int M = 5005;
int n, m, k, p;
int h[N], a[N], d[M];
bool check(long long limit) {
  for (int i = 1; i <= m; ++i) {
    d[i] = 0;
  }
  long long cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] > limit) {
      return false;
    }
    cnt = cnt + max(0ll, (h[i] + 1ll * m * a[i] - limit + p - 1) / p);
  }
  if (cnt > m * k) {
    return false;
  }
  for (int i = 1; i <= n; ++i) {
    long long cur = limit;
    while (cur - m * a[i] < 0) {
      long long day = cur / a[i];
      d[day]++;
      cur += p;
    }
  }
  cnt = 0;
  for (int i = 1; i <= m; ++i) {
    cnt += k;
    cnt -= d[i];
    if (cnt < 0) {
      return false;
    }
  }
  return true;
}
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 = 10000000000000;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%lld\n", l);
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  return MAIN();
}
