Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Special Olympics

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine.

Let us remind you that a ring is a region located between two concentric circles with radii *r* and *R* (*r* < *R*). These radii are called internal and external, respectively. Concentric circles are circles with centers located at the same point.

Soon a white canvas, which can be considered as an infinite Cartesian plane, had two perfect rings, painted with solid black paint. As Sasha is very impulsive, the rings could have different radii and sizes, they intersect and overlap with each other in any way. We know only one thing for sure: the centers of the pair of rings are not the same.

When Sasha got tired and fell into a deep sleep, a girl called Ilona came into the room and wanted to cut a circle for the sake of good memories. To make the circle beautiful, she decided to cut along the contour.

We'll consider a contour to be a continuous closed line through which there is transition from one color to another (see notes for clarification). If the contour takes the form of a circle, then the result will be cutting out a circle, which Iona wants.

But the girl's inquisitive mathematical mind does not rest: how many ways are there to cut a circle out of the canvas?

Input

The input contains two lines.

Each line has four space-separated integers *x*_{i}, *y*_{i}, *r*_{i}, *R*_{i}, that describe the *i*-th ring; *x*_{i} and *y*_{i} are coordinates of the ring's center, *r*_{i} and *R*_{i} are the internal and external radii of the ring correspondingly ( - 100 ≤ *x*_{i}, *y*_{i} ≤ 100; 1 ≤ *r*_{i} < *R*_{i} ≤ 100).

It is guaranteed that the centers of the rings do not coinside.

Output

A single integer — the number of ways to cut out a circle from the canvas.

Examples

Input

60 60 45 55

80 80 8 32

Output

1

Input

60 60 45 55

80 60 15 25

Output

4

Input

50 50 35 45

90 50 35 45

Output

0

Note

Figures for test samples are given below. The possible cuts are marked with red dotted line.

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/26/2017 23:50:28 (c3).

Desktop version, switch to mobile version.

User lists

Name |
---|