ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural Regional School Programming Contest 2012

About     Problems     Submit solution     Judge status     Standings
Contest is over

H. Herbs and Magic

Time limit: 1.0 second
Memory limit: 64 MB
The world is in danger! You-Probably-Know-Who imprisoned Harry Potter and now ready to take over the world. Only Harry can stop him, but first he needs to get out of prison. After a long thinking he decided that the only possible way to free himself is to prepare an Explosion potion. He even found a cauldron in his cell. Now there's a need for main ingredient — tearing herb. Luckily, Harry has its seeds in the pocket, so he just needs to sprout them.
From the herbology lessons Harry knows that tearing herb grows only when being lit from at least two different sides.
Almost desperate, Harry started to explore his prison. He found out that You-Have-Probably-Guessed-Who built for him an infinite cell. Somewhere on the infinitely far wall there were two windows, trough which light was falling on the floor, forming too wide stripes. Help Harry to calculate the area of a site, where he can put the tearing herb seeds to grow them.

Input

First line contains a description of a segment such that all sun rays that fall through the first window cross it at right angle in format x1, y1, x2, y2.
Second line contains description of a similar segment for the second window. All numbers in the input are integers that are not greater then 1000 by the absolute value.

Output

If the site where Harry can put the seeds has an infinite area, output −1. Otherwise output this area with an absolute or relative error up to 10−6.

Sample

inputoutput
0 0 2 0
0 0 0 2
4
Problem Author: Artyom Averin
Problem Source: Ural Regional School Programming Contest 2012
To submit the solution for this problem go to the Problem set: 1927. Herbs and Magic