// Arup Guha
// 11/13/2012
// Solution to 2012 South East Regional (D1) Problem B: Collision Detection

import java.util.*;

public class b {

	// This is more than necessary. But since the algorithm is O(n) for n steps, this is completely fine.
	// Theoretically, since both cars can move at most 80 ft/sec, in a single second their distance can
	// change at most by 160 ft/sec. If I set DANGER to 19.5, then I have a 1.5 ft cushion. This means
	// that I ought to be fine as long as I sample slightly more than 160/1.5 = 106.7 times. Thus, 110
	// should be perfectly fine. The judge data is pretty weak. I set this to 1, and still got all the
	// correct answers.
	final public static int STEPSPERSEC = 10000;

	// Based on what they say the data will be in the problem...this gives us some cushion.
	final public static double DANGER = 19.5;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		double[][] data = new double[4][4];
		for (int i=0; i<4; i++)
			data[0][i] = stdin.nextDouble();

		observation first = new observation(data[0][0], data[0][1], data[0][2], data[0][3]);

		while (data[0][0] != -1) {

			// Read the rest of this...
			for (int i=1; i<4; i++)
				for (int j=0; j<4; j++)
					data[i][j] = stdin.nextDouble();

			// Set up the first car.
			observation second = new observation(data[1][0], data[1][1], data[1][2], data[1][3]);
			car prius = new car(first, second);

			// Set up the second car.
			first = new observation(data[2][0], data[2][1], data[2][2], data[2][3]);
			second = new observation(data[3][0], data[3][1], data[3][2], data[3][3]);
			car fit = new car(first, second);

			double startT = Math.max(data[1][0], data[3][0]);

			int tooClose = 0;

			// Go for 30 seconds.
			for (int i=0; i<=30*STEPSPERSEC; i++) {

				double t = startT + 1.0*i/STEPSPERSEC;

				// Find where we are.
				point p1 = prius.position(t);
				point p2 = fit.position(t);

				// Get out if we get too close.
				if (p1.distance(p2) <= DANGER) {
					tooClose = 1;
					break;
				}

			}
			System.out.println(tooClose);

			// Read next.
			for (int i=0; i<4; i++)
				data[0][i] = stdin.nextDouble();

			first = new observation(data[0][0], data[0][1], data[0][2], data[0][3]);
		}
	}
}

class car {

	public observation prev;
	public observation next;

	public car(observation a, observation b) {
		prev = a;
		next = b;
	}

	// Returns a car's acceleration. This is safe since the two observations aren't at the same time.
	public double getAcc() {
		return (next.vel - prev.vel)/(next.t-prev.t);
	}

	// Precondition: t > next.t
	public point position(double t) {

		double curVel = prev.vel + (t - prev.t)*getAcc();

		// If there's no acceleration, we have constant movement. This avoids divide by zero errors.
		if (Math.abs(getAcc()) < 1e-10) {
			double moved = prev.vel*(t - prev.t);
			return (prev.p).getPos( (prev.p).getDir(next.p), moved);
		}

		// Car stopped somewhere.
		else if (curVel < 0) {
			double deltat = prev.vel/Math.abs(getAcc());
			double moved = prev.vel*(deltat) + .5*getAcc()*Math.pow(deltat, 2);
			return (prev.p).getPos( (prev.p).getDir(next.p), moved);
		}

		// Car stopped at 80 ft/sec
		else if (curVel > 80) {

			// Move to max speed.
			double deltat = (80 - prev.vel)/Math.abs(getAcc());
			double moved = prev.vel*(deltat) + .5*getAcc()*Math.pow(deltat, 2);

			// Moving at constant speed.
			moved = moved + (t - (prev.t + deltat))*80;
			return (prev.p).getPos( (prev.p).getDir(next.p), moved);
		}

		// Normal movement.
		else {
			double moved = prev.vel*(t - prev.t) + .5*getAcc()*Math.pow(t - prev.t, 2);
			return (prev.p).getPos( (prev.p).getDir(next.p), moved);
		}

	}
}

class point {

	public double x;
	public double y;

	public point(double myx, double myy) {
		x = myx;
		y = myy;
	}

	// Usual distance formula.
	public double distance(point other) {
		return Math.sqrt(Math.pow(other.x-x,2) + Math.pow(other.y-y, 2));
	}

	// Only to be used for vectors.
	public double magnitude() {
		return Math.sqrt(x*x+y*y);
	}

	// Returns the place we'll be moving in dir for distance units. dir is a vector...
	public point getPos(point dir, double distance) {

		// Avoid divide by 0.
		if (dir.magnitude() > 0)
			return new point(this.x + dir.x/dir.magnitude()*distance, this.y + dir.y/dir.magnitude()*distance);
		else
			return this;
	}

	public point getDir(point later) {
		return new point(later.x - this.x, later.y - this.y);
	}
}

class observation {

	public double t;
	public point p;
	public double vel;

	public observation(double t1, double myx, double myy, double myv) {
		t = t1;
		p = new point(myx, myy);
		vel = myv;
	}
}