Nathan O. Davis is challenging a kind of shooter game. In this game, enemies emit laser beams from outside of the screen. A laser beam is a straight line with a certain thickness. Nathan moves a circular-shaped machine within the screen, in such a way it does not overlap a laser beam. As in many shooters, the machine is destroyed when the overlap happens.

Nathan is facing an uphill stage. Many enemies attack simultaneously in this stage, so eventually laser beams fill out almost all of the screen. Surprisingly, it is even possible he has no "safe area" on the screen. In other words, the machine cannot survive wherever it is located in some cases.

The world is as kind as it is cruel! There is a special item that helps the machine to survive any dangerous situation, even if it is exposed in a shower of laser beams, for some seconds. In addition, another straight line (called "a warning line") is drawn on the screen for a few seconds before a laser beam is emit along that line.

The only problem is that Nathan has a little slow reflexes. He often messes up the timing to use the special item. But he knows a good person who can write a program to make up his slow reflexes - it's you! So he asked you for help.

Your task is to write a program to make judgement whether he should use the item or not, for given warning lines and the radius of the machine.



Input

The input is a sequence of datasets. Each dataset corresponds to one situation with warning lines in the following format:

W H N R
x1,1 y1,1 x1,2 y1,2 t1
x2,1 y2,1 x2,2 y2,2 t2
...
xN,1 yN,1 xN,2 yN,2 tN


The first line of a dataset contains four integers W, H, N and R (2 < W ≤ 640, 2 < H ≤ 480, 0 ≤ N ≤ 100 and 0 < R < min{W, H}/2). The first two integers W and H indicate the width and height of the screen, respectively. The next integer N represents the number of laser beams.

The last integer R indicates the radius of the machine. It is guaranteed that the output would remain unchanged if the radius of the machine would become larger by 10-5 than R.

The following N lines describe the N warning lines. The (i+1)-th line of the dataset corresponds to the i-th warning line, which is represented as a straight line which passes through two given different coordinates (xi,1, yi,1 ) and (xi,2 , yi,2 ). The last integer ti indicates the thickness of the laser beam corresponding to the i-th warning line.

All given coordinates (x, y) on the screen are a pair of integers (0 ≤ x ≤ W, 0 ≤ y ≤ H). Note that, however, the machine is allowed to be located at non-integer coordinates during the play.

The input is terminated by a line with four zeros. This line should not be processed.

Output

For each case, print "Yes" in a line if there is a safe area, or print "No" otherwise.

Example

Input

100 100 1 1
50 0 50 100 50
640 480 1 1
0 0 640 480 100
0 0 0 0


Output

No
Yes
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

const double DELTA = 1e-5;

/* typedef */

template <typename T>
struct Pt {
  T x, y;

  Pt() {}
  Pt(T _x, T _y) : x(_x), y(_y) {}
  Pt(const Pt& pt) : x(pt.x), y(pt.y) {}

  bool operator==(const Pt pt) const { return x == pt.x && y == pt.y; }
  Pt<T> operator+(const Pt pt) const { return Pt<T>(x + pt.x, y + pt.y); }
  Pt<T> operator-() const { return Pt<T>(-x, -y); }
  Pt<T> operator-(const Pt pt) const { return Pt<T>(x - pt.x, y - pt.y); }
  Pt<T> operator*(T t) const { return Pt<T>(x * t, y * t); }
  Pt<T> operator/(T t) const { return Pt<T>(x / t, y / t); }
  T dot(Pt v) const { return x * v.x + y * v.y; }
  T cross(Pt v) const { return x * v.y - y * v.x; }
  Pt<T> mid(const Pt pt) { return Pt<T>((x + pt.x) / 2, (y + pt.y) / 2); }
  T d2() { return x * x + y * y; }
  double d() { return sqrt(d2()); }

  Pt<T> rot(double th) {
    double c = cos(th), s = sin(th);
    return Pt<T>(c * x - s * y, s * x + c * y);
  }

  Pt<T> rot90() { return Pt<T>(-y, x); }

  bool operator<(const Pt& pt) const {
    return x < pt.x || (x == pt.x && y < pt.y);
  }

  void print(string format) {
    printf(("(" + format + ", " + format + ")\n").c_str(), x, y);
  }
  void print() { print("%.6lf"); }
};

typedef Pt<double> pt;
typedef vector<pt> vpt;
typedef vector<vpt> vvpt;

struct CL {
  pt p;
  double t0, t1;
  CL() {}
  CL(const pt& _p, double _t0, double _t1) : p(_p), t0(_t0), t1(_t1) {}
};

struct Laser {
  pt p0, p1;
  double t;
};

/* global variables */

int w, h, n, r;
Laser lsrs[MAX_N];

vvpt cps[2];

/* subroutines */

bool cross_lines(const pt& a0, const pt& da, const pt& b0, const pt& db,
                 CL& cl) {
  double op01 = da.cross(db);
  if (op01 == 0.0) return false; /* need to handle parallel?? */

  pt v = b0 - a0;
  double op0 = v.cross(da);
  double op1 = v.cross(db);

  double t0 = op1 / op01;
  double t1 = op0 / op01;

  cl.p = db * t1 + b0;
  cl.t0 = t0;
  cl.t1 = t1;
  return true;
}

void convex_cut(const vpt& scpol, vpt& dcpol, const pt& p0, const pt& v) {
  int nn = scpol.size();
  dcpol.clear();

  for (int i = 0; i < nn; i++) {
    pt cpt0 = scpol[i];
    double cr0 = v.cross(cpt0 - p0);
    if (cr0 >= 0.0) dcpol.push_back(cpt0);
    
    pt cpt1 = scpol[(i + 1) % nn];
    double cr1 = v.cross(cpt1 - p0);
    if (cr0 * cr1 < 0.0) {
      CL cl;
      cross_lines(p0, v, cpt0, cpt1 - cpt0, cl);
      dcpol.push_back(cl.p);
    }
  }
}

/* main */

int main() {
  for (;;) {
    cin >> w >> h >> n >> r;
    if (n == 0) break;
    //printf("w=%d,h=%d,n=%d,r=%d\n", w, h, n, r);
    
    for (int i = 0; i < n; i++) {
      Laser& li = lsrs[i];
      cin >> li.p0.x >> li.p0.y >> li.p1.x >> li.p1.y >> li.t;
    }

    vpt scr;
    scr.push_back(pt(r, r));
    scr.push_back(pt(w - r, r));
    scr.push_back(pt(w - r, h - r));
    scr.push_back(pt(r, h - r));

    cps[0].clear();
    cps[0].push_back(scr);

    int cur = 0, nxt = 1;

    for (int i = 0; i < n; i++) {
      Laser& li = lsrs[i];

      pt v = li.p1 - li.p0;
      pt d = v.rot90() / v.d() * (li.t + r + DELTA);

      pt p0 = li.p0 + d, v0 = v;
      pt p1 = li.p0 - d, v1 = -v;
      
      cps[nxt].clear();

      for (vvpt::iterator vvit = cps[cur].begin();
	   vvit != cps[cur].end(); vvit++) {
	vpt cpol;
	convex_cut(*vvit, cpol, p0, v0);
	if (cpol.size() >= 3) cps[nxt].push_back(cpol);
	convex_cut(*vvit, cpol, p1, v1);
	if (cpol.size() >= 3) cps[nxt].push_back(cpol);
      }

      cur ^= 1;
      nxt ^= 1;
    }

    if (false) {
      vvpt& cpc = cps[cur];
      printf("%lu\n", cpc.size());
      for (int i = 0; i < cpc.size(); i++) {
	for (int j = 0; j < cpc[i].size(); j++)
	  printf("(%lf,%lf)", cpc[i][j].x, cpc[i][j].y);
	putchar('\n');
      }
    }
      
    cout << (cps[cur].size() > 0 ? "Yes" : "No") << endl;
  }
  
  return 0;
}