import java.util.*; public class PC { public static final int MAX = 50; public static final int MAXP = 2500; public static loc [] offense = new loc[MAXP]; public static box [] defense = new box[MAXP]; public static void main(String [] args) { Scanner in = new Scanner(System.in); int r, c, no, nd, icase = 0; r = in.nextInt(); c = in.nextInt(); no = in.nextInt(); nd = in.nextInt(); while (r > 0) { icase++; for(int i=0; i= b && a <= c); } public boolean intersectInterval(double a, double b, double c, double d) { return between(a,c,d) || between(b, c, d) || between(c, a, b) || between(d, a, b); } public boolean intersect(double a, double b, double c, double d) { //System.out.println("Intersect " + x1 + " " + y1 + ", " + x2 + " " + y2); //System.out.println(" a, b, c, d = " + a + " " + b + ", " + c + " " + d); // special case: pass within defender's box if (between(a, x1, x2) && between(c, x1, x2) && between(b, y1, y2) && between(d, y1, y2)) return true; // special cases: vertical pass... if (a == c) { if (!between(a, x1, x2)) return false; return intersectInterval(Math.min(b,d), Math.max(b,d), y1, y2); } // ... and horizontal pass else if (b == d) { if (!between(b, y1, y2)) return false; return intersectInterval(Math.min(a,c), Math.max(a,c), x1, x2); } // check for intersection on left and right //System.out.println("here"); if (c < a) { double tmp = a; a = c; c = tmp; tmp = b; b = d; d = tmp; } //System.out.println(" a, b, c, d = " + a + " " + b + ", " + c + " " + d); if (x2 < a || x1 > c) return false; if (between(x2, a, c)) { //System.out.println("x2 = " + x2); double y = b + (x2-a)*(d-b)/(c-a); //System.out.println("y, y1, y2 = " + y + " " + y1 + " " + y2); if (between(y, y1, y2)) return true; } if (between(x1, a, c)) { //System.out.println("x1 = " + x1); double y = b + (x1-a)*(d-b)/(c-a); //System.out.println("y, y1, y2 = " + y + " " + y1 + " " + y2); if (between(y, y1, y2)) return true; } // check for intersection on top and bottom if (d < b) { double tmp = a; a = c; c = tmp; tmp = b; b = d; d = tmp; } if (y2 < b || y1 > d) return false; if (between(y2, b, d)) { double x = a + (y2-b)*(c-a)/(d-b); if (between(x, x1, x2)) return true; } if (between(y1, b, d)) { double x = a + (y1-b)*(c-a)/(d-b); if (between(x, x1, x2)) return true; } return false; } }