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-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/23/2018 21:53:20 (d1).

Desktop version, switch to mobile version.

User lists

Name |
---|