#include <bits/stdc++.h>
using namespace std;
const int NN = 100000 + 117;
const int MM = 100000 + 117;
int read() {
  int fl = 1, x;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    fl = -1;
    c = getchar();
  }
  for (x = 0; c >= '0' && c <= '9'; c = getchar())
    x = (x << 3) + (x << 1) + c - '0';
  return x * fl;
}
void open() { freopen("a.in", "r", stdin); }
void close() {
  fclose(stdin);
  fclose(stdout);
}
int m, n, k;
long long cut;
long long a[NN] = {};
long long g[NN] = {};
int tim[NN] = {};
long long ceil(long long a, long long b) {
  long long res = (a + b - 1) / b;
  if (res < 0) res = 0;
  return res;
}
bool chk(long long mid) {
  long long tot = 0;
  for (int i = 1; i <= n; ++i) {
    tot += ceil(a[i] + g[i] * m - mid, cut);
  }
  if (tot > k * m) return false;
  for (int i = 1; i <= m; ++i) {
    tim[i] = 0;
  }
  for (int i = 1; i <= n; ++i) {
    long long all = ceil(a[i] + g[i] * m - mid, cut);
    long long ex = all * cut - (a[i] + g[i] * m - mid);
    long long now = a[i] + ex;
    int t = 1;
    for (int it = 1; it <= all; ++it) {
      int tp = ceil(cut - now, g[i]);
      t += tp;
      now += tp * g[i];
      if (t > m) return false;
      tim[t]++;
    }
  }
  int need = 0;
  for (int i = 1; i <= m; ++i) {
    need += tim[i];
    need = max(0, need - k);
  }
  return !need;
}
int main() {
  n = read();
  m = read();
  k = read();
  cut = read();
  long long r = 0, l = 0;
  for (int i = 1; i <= n; ++i) {
    a[i] = read();
    g[i] = read();
    r = max(r, a[i] + g[i] * m);
  }
  while (l != r) {
    long long mid = (l + r) >> 1;
    if (chk(mid)) {
      r = mid;
    } else
      l = mid + 1;
  }
  cout << l << endl;
  close();
  return 0;
}
