#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e15;
long long n, m, k, p, l, r;
long long h[100000 + 5], a[100000 + 5];
long long now[100000 + 5];
struct cmp {
  bool operator()(pair<long long, long long> a, pair<long long, long long> b) {
    return a.first > b.first;
  }
};
bool judge(long long x) {
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >, cmp>
      q;
  for (long long i = 0; i < n; ++i) {
    now[i] = x;
    if (x - m * a[i] >= 0) continue;
    q.push(make_pair(x / a[i], i));
  }
  long long times = 0;
  for (; times <= k * m; times++) {
    if (q.empty()) break;
    pair<long long, long long> temp = q.top();
    q.pop();
    if (temp.first <= times / k) return 0;
    long long index = temp.second;
    now[index] += p;
    if (now[index] - m * a[index] >= 0) continue;
    q.push(make_pair(now[index] / a[index], index));
  }
  if (times > k * m) return 0;
  for (int i = 0; i < n; ++i) {
    long long temp = m * a[i] + h[i] - now[i];
    if (temp <= 0)
      continue;
    else
      times += ((temp / p) + (long long)(temp % p != 0));
    if (times > k * m) return 0;
  }
  return 1;
}
int main(void) {
  scanf("%I64d%I64d%I64d%I64d", &n, &m, &k, &p);
  l = 1, r = MAX;
  for (long long i = 0; i < n; ++i) scanf("%I64d%I64d", &h[i], &a[i]);
  while (l < r) {
    if (judge(((l + r) >> 1)))
      r = ((l + r) >> 1);
    else
      l = ((l + r) >> 1) + 1;
  }
  printf("%I64d\n", l);
}
