#include <bits/stdc++.h>
using namespace std;
const int rlen = 1 << 18 | 1;
char buf[rlen], *ib = buf, *ob = buf;
inline int read() {
  int ans = 0;
  char ch =
      (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)), ib == ob)
           ? -1
           : *ib++);
  while (!isdigit(ch))
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  while (isdigit(ch))
    ans = ((ans << 2) + ans << 1) + (ch ^ 48),
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  return ans;
}
inline long long readl() {
  long long ans = 0;
  char ch =
      (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)), ib == ob)
           ? -1
           : *ib++);
  while (!isdigit(ch))
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  while (isdigit(ch))
    ans = ((ans << 2) + ans << 1) + (ch ^ 48),
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  return ans;
}
inline int Read(char* s) {
  int top = 0;
  char ch =
      (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)), ib == ob)
           ? -1
           : *ib++);
  while (!isdigit(ch) && !isalpha(ch))
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  while (isdigit(ch) || isalpha(ch))
    s[++top] = ch,
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  return top;
}
namespace modular {
const int mod = 998244353;
inline int add(int a, int b) { return a + b < mod ? a + b : a + b - mod; }
inline int dec(int a, int b) { return a < b ? a - b + mod : a - b; }
inline int mul(int a, int b) { return (long long)a * b % mod; }
inline void Add(int& a, int b) { a = a + b < mod ? a + b : a + b - mod; }
inline void Dec(int& a, int b) { a = a < b ? a - b + mod : a - b; }
inline void Mul(int& a, int b) { a = (long long)a * b % mod; }
inline int ksm(int a, int p) {
  int ret = 1;
  for (; p; p >>= 1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
  return ret;
}
inline int Inv(int a) { return ksm(a, mod - 2); }
inline int sqr(int a) { return (long long)a * a % mod; }
inline int cub(int a) { return (long long)a * a % mod * a % mod; }
}  // namespace modular
using namespace modular;
const int N = 1e5 + 5;
int n, m, K;
long long cur[N], a[N], h[N], dt;
inline bool check(long long t) {
  priority_queue<pair<long long, int> > q;
  for (register int i = 1; i <= n; ++i) {
    cur[i] = t;
    if (t - a[i] * m < h[i]) q.push(pair<long long, int>(-t / a[i], i));
  }
  long long tmp;
  for (register int id, Turn = 1; Turn <= m; ++Turn)
    for (register int tim = K; tim; --tim) {
      if (!q.size()) return 1;
      pair<long long, int> cr = q.top();
      q.pop(), tmp = -cr.first, id = cr.second;
      if (tmp < Turn) return 0;
      cur[id] += dt;
      if (cur[id] - a[id] * m < h[id])
        q.push(pair<long long, int>(-cur[id] / a[id], id));
    }
  return !q.size();
}
int main() {
  n = read(), m = read(), K = read(), dt = read();
  long long L = 0, R = 0, res;
  for (register int i = 1; i <= n; ++i)
    h[i] = read(), L = max(L, a[i] = read()), R = max(R, h[i] + a[i] * m);
  res = R;
  while (L <= R) {
    long long mid = (L + R) >> 1;
    if (check(mid))
      R = mid - 1, res = mid;
    else
      L = mid + 1;
  }
  cout << res;
  return 0;
}
