AlgoUniversity
  • Go Back
Discussion
Shopping With Wife :

Author

Ujjwal Srivastava

Difficulty Level : Medium

Submissions : 152

Asked In : Gameskraft

Marks :30

: 3 | : 0

Sam is visiting a shopping mall. If this mall is mapped to a 2D plane - each coordinate point inside this mall (including the borders) would represent a shop. The bottom-left and top-right coordinates of this mall are $$$(x1,y1)$$$ and $$$(x2,y2)$$$ respectively.

Sam's wife is standing at a point $$$(x_{C},y_{C})$$$ either inside or outside the mall.

Sam, being a caring husband, wants to always be within a distance of R from his wife. What are the total number of shops that Sam can visit?

Input

The first line contains four integers $$$x1, y1, x2, y2$$$ $$$(x1 < x2)$$$ and $$$(y1 < y2)$$$ The second line contains three integers $$$x_{C}$$$,$$$y_{C}$$$, $$$R$$$.$$$(-100000 \le x1, y1, x2, y2 \le 100000)$$$$$$(-100000 \le x_{C},y_{C} \le 100000)$$$ $$$(0 \le R \le 100000).$$$

Output

Print one number denoting the total number of shops that Sam can visit considering the above restrictions.

Examples

Input
-4 -9 109 213
4 4 4
Output
49
Input
0 0 1 1
2 2 2
Output
1

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.