#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int read() {
  int f = 1, g = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) g = g * 10 + ch - '0';
  return f * g;
}
int n, m, K, L;
long long g[N], a[N], b[N];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    f;
bool check(long long mid) {
  while (!f.empty()) f.pop();
  for (int i = 1; i <= n; i++) {
    g[i] = mid;
    if (g[i] - a[i] * m < b[i]) f.push(make_pair(g[i] / a[i], i));
  }
  for (int i = 1; i <= m; i++) {
    if (f.empty()) return true;
    if (f.top().first < i) return false;
    for (int j = 1; j <= K; j++) {
      int x = f.top().second;
      f.pop();
      g[x] += L;
      if (g[x] - a[x] * m < b[x]) f.push(make_pair(g[x] / a[x], x));
      if (f.empty()) return true;
    }
  }
  for (int i = 1; i <= n; i++)
    if (g[i] - a[i] * m < b[i]) return false;
  return true;
}
int main() {
  n = read();
  m = read();
  K = read();
  L = read();
  for (int i = 1; i <= n; i++) b[i] = read(), a[i] = read();
  long long l = 0, r = 1e13, mid;
  while (l < r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%lld\n", l);
  return 0;
}
