#include <bits/stdc++.h>
using namespace std;
struct node {
  long long a, h, t1, xy, t;
  bool operator<(const node& y) const { return t1 < y.t1; }
  node(long long na = 0, long long nh = 0, long long nt1 = 0, long long nxy = 0,
       long long nt = 0) {
    a = na;
    h = nh;
    t1 = nt1;
    xy = nxy;
    t = nt;
  }
} v;
long long l, r, mid, n, m, p, k, tm, h[100005], a[100005];
const long long inf = 1e14;
multiset<node> st;
multiset<node>::iterator it;
long long solve(long long st, long long eve, long long ed) {
  return (st - ed + eve) / eve;
}
bool chk(long long x) {
  long long nxy;
  st.clear();
  for (int i = 1; i <= n; i++)
    if (x - m * a[i] < h[i])
      st.insert(node(a[i], h[i], solve(x, a[i], 0), x, 0));
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= k; j++) {
      if (st.empty()) return true;
      v = *st.begin();
      st.erase(st.begin());
      nxy = v.xy - v.a * (1ll * i - v.t);
      if (nxy < 0) return false;
      nxy += p;
      if (nxy - v.a * (m - i) >= v.h) continue;
      v.t = i;
      v.t1 = i + solve(nxy, v.a, 0);
      v.xy = nxy;
      st.insert(v);
    }
  }
  if (st.empty()) return true;
  return false;
}
int main() {
  scanf("%lld%lld%lld%lld", &n, &m, &k, &p);
  for (int i = 1; i <= n; i++) scanf("%lld%lld", &h[i], &a[i]);
  l = 1;
  r = inf;
  while (l < r) {
    mid = (l + r) / 2;
    if (chk(mid))
      r = mid;
    else
      l = mid + 1;
  }
  printf("%lld\n", l);
  return 0;
}
